Hello! In my game there are times where lots of units need to constantly update their destination to chase the player. I am finding the setting FollowerEntity.SetDestination is not super great for performance to do every frame - I am assuming because of the ECS overhead.
Is there a way to make this more efficient? Possibly by creating some sort of ECS communication channel?
If you have a Transform as a target, the AIDestinationSetter is actually faster. Try it.
Alternatively you can set:
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.SetComponent(follower.entity, new DestinationPoint { ... });
However, this will not update things like follower.remainingDistance and follower.reachedDestination until the next frame. This is in contrast to follower.SetDestination which will immediately repair its path to make sure properties like that are up to date (this is what is causing most of the performance overhead). So make sure your code can handle them being slightly out of sync.