void Start() { navmesh = transform.GetComponent <NavMeshAgent>(); if (path.GetComponent <AIPath>()) { PathScript = path.GetComponent <AIPath>(); navmesh.SetDestination(PathScript.GetFirstCheckpoint()); } }