Search Unity

NavMeshAgent_pathStatus

Discussion in 'Scripting' started by LukasLicek, Feb 6, 2016.

  1. LukasLicek

    LukasLicek

    Joined:
    May 25, 2014
    Posts:
    3
    Hello, Im quite desperate about this little script I wrote. (Problem is written in bold).
    I have tried everything which i could think of. Actually, this is my first thread after 1,5 year :D
    Anyway, I think its just an syntax error. Please help :) Lukas

    (Error message:Operator '==' cannot be used with a left hand side of type 'UnityEngine.NavMeshPathStatus' and a right hand side of type 'System.Object'.)
    ______________________________________________________
    private var player : Transform;
    private var nav : NavMeshAgent;


    function Awake ()
    {
    player = GameObject.FindGameObjectWithTag ("Player").transform;
    nav = GetComponent (NavMeshAgent);
    nav.SetDestination (player.position);
    }

    function Update (){
    if(nav.pathStatus==nav.NavMeshPathStatus.completed){
    Debug.Log("Path_OK");
    }
    }