Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Possible to run NavMeshAgent in edit mode?

Discussion in 'Navigation' started by nicknikolaou, Sep 27, 2021.

  1. nicknikolaou

    nicknikolaou

    Joined:
    Apr 5, 2021
    Posts:
    1
    Is it possible to have a NavMeshAgent move to the goal in edit mode? (when the game is not running)

    I'm getting the following error when trying to setDestination() from a custom editor:

    "SetDestination" can only be called on an active agent that has been placed on a NavMesh.


    Edit: Just to clarify, the agent runs fine when I run the game. I'm only having trouble running it from the editor.
     
  2. Arkanoidal

    Arkanoidal

    Joined:
    Sep 6, 2013
    Posts:
    6
    Having the same problem
     
  3. FardinHaque

    FardinHaque

    Joined:
    Apr 13, 2015
    Posts:
    7
    Use NavMesh.CalculatePath(Vector3 sourcePosition, Vector3 targetPosition, int areaMask, AI.NavMeshPath path). Anything NavMeshAgent related doesn't seem to work in edit mode.