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

I have a problem: 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?

Edit: Not being able to hide an actor’s child actor component is probably a bug: [4.7.5] 'Hidden in game' and 'visible' ignored for child actors - Rendering - Unreal Engine Forums

Hello Slavq,

I have made some tests here and i was able to hide an actor with some child actors components using the follow setup, it has been made on level blueprint just for tests purposes.

Thanks @iorek01, ‘Set Visibility’ of Default Scene Root instead of Set Hidden In Game works! Even if ‘Set Visibility’ is oficially meant to be used only for in-editor visibility, which is strange :smiley:

  • Tip: For child actors added in Contruction Script via ‘Add Child Actor Component’ node, child actors must be attached to the component that we use ‘Set Visibility’ on.

Edit: This is without using ForEach and it practically answers my question, but it still lags :frowning: Probably because it still goes through all children just like ForEach loop.

Edit2: So this is probably a bug. I’ve posted a report here: Set Actor Hidden In Game doesn't hide child actors - Programming & Scripting - Unreal Engine Forums