System.Action LinkEnter { get; set; }

robot_2Generated
code_blocksInput

Description

The LinkEnter property is an event of type System.Action that is triggered when the NavMeshAgent enters a link. This event allows you to execute custom logic whenever the agent begins traversing a link in the navigation mesh.

Usage

To use the LinkEnter event, you can subscribe a method to it that will be called whenever the agent enters a link. This is useful for handling specific actions or behaviors that should occur at the start of a link traversal.

Example

// Example of subscribing to the LinkEnter event
NavMeshAgent agent = new NavMeshAgent();

// Define a method to handle the event
void OnLinkEnter()
{
    // Custom logic to execute when the agent enters a link
    // For example, log a message or change agent behavior
    Log.Info("Agent has entered a link.");
}

// Subscribe the method to the LinkEnter event
agent.LinkEnter += OnLinkEnter;

// Ensure to unsubscribe when no longer needed to prevent memory leaks
// agent.LinkEnter -= OnLinkEnter;