Description
The Radius
property of the NavMeshAgent
class represents the radius of the agent in the navigation mesh. This property is used to define the physical size of the agent, which affects how it navigates through the environment, particularly in relation to obstacles and other agents.
Usage
To set or get the radius of a NavMeshAgent
, you can use the Radius
property. This property is a float
and can be adjusted to fit the desired size of the agent in the navigation mesh.
Example usage:
NavMeshAgent agent = new NavMeshAgent();
agent.Radius = 0.5f; // Set the radius to 0.5 units
float currentRadius = agent.Radius; // Get the current radius
Example
// Create a new NavMeshAgent instance
NavMeshAgent agent = new NavMeshAgent();
// Set the radius of the agent
agent.Radius = 0.5f;
// Retrieve the current radius of the agent
float currentRadius = agent.Radius;
// Output the current radius
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use appropriate logging or debugging tools
// Debug.Log($"Current Radius: {currentRadius}");