Class AIDestinationSetter Extends VersionedMonoBehaviour, IComponentData, IRuntimeBaker
Sets the destination of an AI to the position of a specified object.
This component should be attached to a GameObject together with a movement script such as AIPath, RichAI or AILerp. This component will then make the AI move towards the target set on this component.
Essentially the only thing this component does is to set the Pathfinding.IAstarAI.destination property to the position of the target every frame. But there is some additional complexity to make sure that the destination is updated immediately before the AI searches for a path as well, in case the target moved since the last Update. There is also some complexity to reduce the performance impact, by using the BatchedEvents system to process all AIDestinationSetter components in a single batch.
When using ECS, this component is instead added as a managed component to the entity. The destination syncing is then handled by the SyncDestinationTransformSystem for better performance.
Public Variables
The object that the AI should move to.