Tick calling code in all actors. How can i avoid it?

I don’t see anything wrong with a simple if in the tick.

You can store that condition in a bool variable on begin play like:

controlled = Character && Character->IsLocallyControlled();

then in the ticker you just do

if(controlled)

that way you save to call IsLocallyControlled() all the time in all the actors.

also think if your behavior needs to be called every tick. If not you can just avoid ticker and use a function with a timer for the specific behavior setting the timer function in begin play too.

also you can make a ‘special behavior’ actor and then if you are locally controller you can just create a child actor with that ‘special beehavior’ actor and what it does is ‘some special vehavior’ in its parent/owner

2 Likes