float Radius { get; set; }

robot_2Generated
code_blocksInput

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, 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.

Changing the radius will automatically mark the agent as dirty, meaning that any changes will be reflected in the next update cycle.

Example

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

// Set the radius of the agent
agent.Radius = 0.5f;

// Get the current radius of the agent
float currentRadius = agent.Radius;

// Output the current radius
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a logging system or in-game UI to display information
// Log.Info($"Current Radius: {currentRadius}");