How to hide/unhide a bunch of StaticMeshActors at once

Looking for the best way to hide/unhide dozens, if not hundreds of StaticMeshActors at once

Hey there @SOLDIEROSCAR! Implementation is mostly the same, taking a reference to them as an array or list and iterating through it, but the “how” depends entirely on your use case, so I have a couple questions!

Does this need to be at runtime or in editor?

Do you have a way of categorizing them? (Are they all the same class or children of the class? Or is there some other indicator like a Gameplay tag?) If not, you may need to store a variable reference to them (likely in an array), before we can iterate on them.

1 Like

Basically I am trying to show an item thru an Orthographic camera. I would like the option to toggle everything else on/ off (Basically whatever map, and static actors are in the scene).

Someone else suggested using “Data Layers”

an alternative is event dispatcher.
make an actor manager or even just use the player as the manager.

create an event dispatcher in player blueprint called “on show/hide” .

and then have the static mesh actors to get player at their begin play.

drag a line out from the player search for the dispatcher you just created in the player.bind an event to it.

player then can call the dispatcher with a button press or anything.
The actors will auto respond to the player

Data Layers are great when you have a defined group of actors that you want to be able to show and hide efficiently, like map components when you change say the weather of a map for example, just not as effective when you need to iterate on different objects at different times. When you want to hide actors that aren’t your selection it’s better to go with an event dispatcher as Bao mentioned.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

kinda needs more context, i mean are they all instances of the same actor? or different ones? If you want you can use the ‘get all actors of class’ node to hide all actors of the same class at once.

Way I would do it is implement an interface with hide and unhide message events.

Then when you need a specific mesh hidden, you send a message through the interface to the specific actor and within that actor’s blueprints, toggle visibility based on which message it received.