x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to toggle the visibility of a static mesh on a spline???

Hey there,

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!

alt text

Product Version: UE 4.18
Tags:
bp.jpg (156.3 kB)
more ▼

asked Jan 08 '18 at 01:51 PM in Blueprint Scripting

avatar image

JtothePP
7 2 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jan 08 '18 at 01:58 PM

avatar image

xlar8or
6k 162 129 305

avatar image JtothePP Jan 08 '18 at 02:44 PM

Thanks for the quick answer. I tried the way with the array and it kind of works. The thing is, only the last mesh is toggling, the rest ist still visible. What is my mistake?

This is what the spline looks like alt text This is what i changed in the construction Script and in the Event Graph. alt text alt text

spline.jpg (35.2 kB)
constscript.jpg (81.0 kB)
eventgraph.jpg (66.8 kB)
avatar image xlar8or Jan 08 '18 at 02:51 PM

You have to call the Add function in the static mesh array instead of that make array and set nodes. The problem with that is that its only adding the last one.

avatar image JtothePP Jan 08 '18 at 02:56 PM

Got it! Thanks a million! You are the hero of my day!!!!

avatar image xlar8or Jan 08 '18 at 03:30 PM

No problem :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question