there is any way to disable or enable an Actor and all components added to that Actor disable at Once?
im aware of SetActorTickEnabled() and SetComponentTickEnabled() but I want to know there is a way enable all components and owner actor disable at once?
I don’t know if there is a simple function (I’ve never looked) but a few possible options are:
In your component tick, first check to see if the tick of the owner is active. If not then don’t do any further processing. This is nice because there are no dependencies (other than an actor component belonging to an actor, which it has to anyway). The components will continue ticking which has a slight overhead, but they will be doing very little each frame (until the owner has its tick re-enabled)
As above but rather than checking if the owner is ticking, check for a specific variable. Seems a bit redundant and creates additional dependencies on certain class types so I wouldn’t recommend
Have a new method on your actor which will first disable / enable the tick on that actor, then look through all attached components and disable / enable their ticks.
After initialisation, have each component listen for an ‘enable’ / ‘disable’ event (which could be triggered by the owner or by some other manager). Might be useful depending on what you really need but also might be a bit overkill.
Personally I recommend going with option 1 or 3. Both are simple to implement and don’t have much to go wrong.