Download

Want to use actors pool, but how to "disable"/"stop" actors?

Hi guys,

I’d like to make a actors pool. It spawns many actors when loading, and make them “dead”, when I want to use one, pop one from the pool and make it “alive”.

Here is my question. I don’t know how to make actors “dead”. I tried SetActorHiddenInGame(), TurnOff() for character, Deactivate() all the components of a actor, SetActorTickEnabled(false). These actors still “run”/“tick”, and lead to low FPS (stat GAME shows Tick Time and World Tick Time is very high). I’d like to know if there is a method that spawn many actors and make to “dead”, then these “dead” actors don’t effect FPS. Thank you!

Have you tried also override AActor:: Tick() on then? Maybe conditioning Super::Tick to some boolean… :smiley:

Yes, I have tried override tick(), but it is useless… :frowning:

Well, LOL…

I must confess that your question lead myself to an exercise that was interesting…

I got my characterclass flagged to don’t Tick to check if there is a bug on the methods, I did this on PostInitializeComponents( ):

PrimaryActorTick.UnRegisterTickFunction();

Also Got a LOG inside TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction) and Tick(float DeltaTime)

The good news is that if you do that instructions on PostInitializeComponents( ) as I told this will prevent TickActor from run (I didn’t tried to restore it after, but this could solve half from your trouble).

Tick Function never runs, the only tick called is TickActor( ).

Now to the bad news, my character still works without any tick interaction oO so, I suspect that it got components ticked from outside (MovementComponent maybe) or into another method.

Hope it helps. :smiley:

EDIT:
I got TickActor() working again calling:

PrimaryActorTick.RegisterTickFunction(GWorld->GetLevel(0));

So if you can manage how to get a level index you can control your ticking guys, notice that also I changed the PostInit Instructions above… :wink: