NavMeshAgent.CompleteOffMeshLink
CompleteOffMeshLink(): void;
void CompleteOffMeshLink();
def CompleteOffMeshLink() as void
Description

Follow the current OffMeshLink.

When the autoTraverseOffMeshLink property is switched off an agent will pause at an off-mesh link until this function is called to let it pass. This can be used to allow characters access selectively (eg, to simulate openable doors or obstacles that only certain characters can pass, etc).
	private var agent: NavMeshAgent;

function Start () { agent = GetComponent.<NavMeshAgent>(); } // Let an agent cross the off-mesh link if he has // the right door key. function CheckForDoorKey(doorKeys: Hashtable) { if (agent.isOnOffMeshLink) { if (doorKeys.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name)) { agent.CompleteOffMeshLink(); } } }
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    private NavMeshAgent agent;
    void Start() {
        agent = GetComponent<NavMeshAgent>();
    }
    void CheckForDoorKey(Hashtable doorKeys) {
        if (agent.isOnOffMeshLink)
            if (doorKeys.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name))
                agent.CompleteOffMeshLink();
            
        
    }
}
import UnityEngine
import System.Collections

public class Example(MonoBehaviour):

	private agent as NavMeshAgent

	def Start() as void:
		agent = GetComponent[of NavMeshAgent]()

	def CheckForDoorKey(doorKeys as Hashtable) as void:
		if agent.isOnOffMeshLink:
			if doorKeys.ContainsKey(agent.currentOffMeshLinkData.offMeshLink.name):
				agent.CompleteOffMeshLink()