How to hide/unhide all Child Actors Components without using ForEach loop?

I want o hide an actor that has many Child Actor Components, but simple ‘Set Actor Hidden In Game’ unfortunately doesn’t work. So as a workaround I store references to all child actor components in array and when needed, call Set Hidden In Game for every child actor in ForEach loop. This works, but lags a lot when many actors try to hide.

The child actor components are parented (AttachToComponent) to one of the components, so I’ve also tried hiding this parent component - but without any luck. Maybe it’s some bug? I thought that if we hide parent component, then all child components will hide too…

Is there a way to somehow hide/show all these child actor components without needing to go through lll of them in ForEach loop?

Set Visibility is what you’re looking for.

Set Visibility works, even if it still goes through all child actors just like in ForEach (= lag in my specific case) - ‘Set Actor Hidden In Game’ would probably solve this problem, but it’s bugged, I’ve created a report here: Set Actor Hidden In Game doesn't hide child actors - Programming & Scripting - Unreal Engine Forums

Anyway, this answers my question :slight_smile: Thanks!