I need to deactivate actors which are far away from player. Function Deactivate is used to deactivate components. Is there a way to deactivate the actor as well.
What do you mean by deactivating? Stop rendering, stop movement?
yes like stop their activities and make them sleep. Stop rendering, stop its tick, etc… and then reactivate it when player is near it. Kinda optimization.
I’m also interested in this. What I’ve done so far, stats using ‘stat unit’ command:
I spawn 200 characters in level and I get around 20 Game ms
When I don’t spawn them, I get around 10 Game ms.
… And this 20 ms is after I’ve disabled them! … And I can’t get to that 10 ms level. What I’ve done:
- For ALL Components: Deactivate, Set Visibility to FALSE, Set Collision to ‘No Collision’
- Set Actor Tick Enabled to FALSE, Set Actor Hidden In Game to HIDDEN, Set Actor Enable Collision to FALSE.
What else can be deactivated to truly deactivate an actor? I remember that in Unity there is a simple deactivation function that completely ‘shuts down’ any game object. I’m trying to recreate that…
UPDATE: CPU Profiling says that ‘Char Movement Total’ eats up to 3ms (instead of 0.5ms when only player is active) even after I disable MovementComponent on ALL spawned characters! Something is wrong…