Class AIDestinationSetter Extends VersionedMonoBehaviour
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. 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.
Private/Protected Members
Updates the AI's destination every frame.
Handle serialization backwards compatibility.
Handle serialization backwards compatibility.
Updates the AI's destination immediately.