Is destination reached - without non-stop checking in Update?

Hello, me again with yet another silly question :slight_smile:

I want my player to play movement animation when it is moving and then idle animation when it reached the destination (and before the new destination is set).

I know I can check in Update(), if he reached the destination yet and based on that set my Animator, however, I am worried about performance.

Is there any other way how to do it? Something maybe event - based? I imagine a callback which could be called when the destination is reached :slight_smile:

Thanks for help!

Hi

The scripts usually don’t require that information to be calculated, so they normally don’t do it.
So any event based system would essentially be doing the same thing as you are doing: i.e. check if the destination is reached in an Update loop and then call the event callback.
Checking if the destination is reached is pretty fast though, unless you have a ton of agents you shouldn’t have to worry.