How to toggle the visibility of a static mesh on a spline???
I made BP class with a spline and added a static mesh component to it. I would like to toggle the visibility of the static mesh. But the static mesh does not disapear when I make the spline invisible? The only way is to set the static mesh invisible in the "add static mesh component" node, but i don´t know how to toggle it this way.
Am I missing something, or is this even the way to do it?? In the end i want to be able to toggle the visibilty with an "OnComponentOverlap" etc.
Thanks for your help, have a great day!
asked Jan 08 '18 at 01:51 PM in Blueprint Scripting
Hey there, when you use Add Static Mesh Component you are creating a new Static Mesh Component and adding it into your actor but it doesnt belong or is parented by the spline, that is why it is still visible when you hide the spline. To make this work you should create an array variable and store all of the static meshes you create so when you want to toggle visibility you just do a for loop in the array and call Toggle Visibility node for each of the meshes. Another way of doing this is by using FindComponentByClass and get all Static Mesh components, so no need for the array, the only problem with this is that it might include some static meshes that were not created by the construction script, so you would need another way to filter them, maybe having a certain tag or something like that.
Follow this question
Once you sign in you will be able to subscribe for any updates here