Invoke Method - run one time?

mike1233

New member
Hi,

I noticed that the Invoke Method action is run each frame, but I want it to run just once.
For instance, at some point in the BT im invoking a function in a script that breaks the gameobject and then destroys it.
Since Invoke Method runs every frame - im getting an error every frame that the gameobject is now missing...
In general, it doesn't seem wise to have a method invoked every frame, no?
How can I force the Invoke Method to run only once?
Thx!

Mike.
 
Invoke Method returns success/failure so by default it only runs once. If you don't want it to run every frame you should restructure your behavior tree so the task only gets called when it should be called rather than every frame.
 
thank you! can you point me in the direction of how to get the Invoke Method to only get called once?
I have it as part of a sequence now...
the overall BT has an endless repeater.
thank you!!
 
the overall BT has an endless repeater.
That's the problem. If your sequence task runs every frame then invoke will run every frame. You should add a conditional task which will prevent the invoke task from running.
 
Top