How to Enable/Disable Tick for All Components in an Actor Efficiently?

Hello!

Does anyone know a convenient method to enable/disable the tick for everything in an actor (components, child actors and their components, movement components, particles, etc.)? I started using a huge for loop for each addition, but it’s becoming an unreadable mess.

Thanks for any advice!

The easiest way is to use a loop and Get Components by Class…
But you can go the other way by using a delegate. Let all objects bind to it and when the delegate is called they can turn off their tick.

Thanks for answering!

I mean, I’m already doing that, if you look at my initial message (just in C++), but I constantly find myself adding stuff that’s not just components—child actors, particles, PCG, and all those things have ticks that also need to be turned on/off.

The binding method is good thinking! But it’s a bit of a workload to go through all classes and add this binding. I was hoping for something more efficient.

I guess I’ll try to look for other solutions. Maybe there are plugins on the Marketplace that change the actors’ tick interval based on distance to the camera/visibility. That would be similar and also a performance optimization that I’m looking for.