Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Navmesh agent problem| navmeshagent.destination does not exist???

Discussion in 'Navigation' started by andreapomposelli, Sep 11, 2015.

  1. andreapomposelli

    andreapomposelli

    Joined:
    Apr 24, 2014
    Posts:
    3
    since i have upgrade to the 5.2 when i try to make an agent the console go crazy.i cant figure it out.
    this is one of seven errors of the origina unitypackage "Mecanim example scene".pls some help??
    Assets/Scripts/Agent.cs(43,31): error CS1061: Type `NavMeshAgent' does not contain a definition for `destination' and no extension method `destination' of type `NavMeshAgent' could be found (are you missing a using directive or an assembly reference?)
     
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,618
  3. naimish1308

    naimish1308

    Joined:
    Jul 10, 2018
    Posts:
    5
    Same Problem
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.AI;
    5.  
    6. public class PeopleNavMesh : MonoBehaviour
    7. {
    8.     public bool isMoving;
    9.    
    10.     public Transform Transform;
    11.     void Start()
    12.     {
    13.      
    14.         Transform = GetComponent<Transform>();
    15.         NavMeshAgent nav = GetComponent<NavMeshAgent>();
    16.         nav.destination = transform.position;
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     /*void Update()
    21.     {
    22.        
    23.         if (isMoving)
    24.         {
    25.             Invoke("Move", 10);
    26.         }
    27.     }
    28.     void Move()
    29.     {
    30.        
    31.     }*/
    32.    
    33. }
    34.  
     
  4. naimish1308

    naimish1308

    Joined:
    Jul 10, 2018
    Posts:
    5
  5. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    277
    You also get the error "error CS1061: Type `NavMeshAgent' does not contain a definition for `destination' and no extension method `destination' of type `NavMeshAgent' could be found (are you missing a using directive or an assembly reference?)"? This could be a very broad issue. I'd try just reimporting your whole project, this is not a code issue for as far as I can see in your case.
     
    naimish1308 likes this.
  6. naimish1308

    naimish1308

    Joined:
    Jul 10, 2018
    Posts:
    5
    i reimported but no use wat shud i do
     
  7. naimish1308

    naimish1308

    Joined:
    Jul 10, 2018
    Posts:
    5
  8. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    277
    Okay, is that the only error you're getting? If not, please send us a clear picture of your error log.