public void Reset() { Pather pather = mesh.GetComponent <Pather>(); if (pather != null) { path = pather.getPath(gameObject, end); currentWaypoint = 0; distance = 0; time = 0; if (path != null && path.Length > 1) { distance = Vector3.Distance(path[currentWaypoint], path[currentWaypoint + 1]); transform.LookAt(path[currentWaypoint + 1]); } } }