void Stop()

book_4_sparkGenerated
code_blocksInput

Description

The Stop method of the NavMeshAgent class is used to halt the agent's movement or any other ongoing actions. This method is useful when you need to immediately stop the agent from moving along its path or performing any navigation-related tasks.

Usage

To use the Stop method, simply call it on an instance of NavMeshAgent. This will immediately stop the agent from moving or performing any navigation tasks.

Example

// Create a new NavMeshAgent instance
NavMeshAgent agent = new NavMeshAgent();

// Move the agent to a target position
agent.MoveTo(new Vector3(10, 0, 10));

// Stop the agent from moving
agent.Stop();