Class Interactable Extends VersionedMonoBehaviour, IOffMeshLinkHandler, IOffMeshLinkStateMachine
Example script for handling interactable objects in the example scenes.
It implements a very simple and lightweight state machine.
This is an example script intended for the A* Pathfinding Project's example scenes. If you need a proper state machine for your game, you may be better served by other state machine solutions on the Unity Asset Store.
It works by keeping a linear list of states, each with an associated action. When an agent iteracts with this object, it immediately does the first action in the list. Once that action is done, it will do the next action and so on.
Some actions may cancel the whole interaction. For example the MoveTo action will cancel the interaction if the agent suddenly had its destination to something else. Presumably because the agent was interrupted by something.
If this component is added to the same GameObject as a NodeLink2 component, the interactable will automatically trigger when the agent traverses the link. Some components behave differently when used during an off-mesh link component. For example the MoveToAction will move the agent without taking the navmesh into account (becoming a thin wrapper for AgentOffMeshLinkTraversalContext.MoveTowards).