Search Unity

NavMeshAgent desyncs from GameObject

Discussion in 'Navigation' started by Ranter1337, Dec 3, 2015.

  1. Ranter1337

    Ranter1337

    Joined:
    Nov 4, 2015
    Posts:
    15
    I am setting a game object to inactive, then attempting to move the object to a different area and re-enabling it, everything i've tried resetting the path, warping, disabling moving then enabling the agent all results in the agent de-syncing itself and moving back to the position where it was set inactive, while the transform is still at the new position
     
  2. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    I don't know how to prevent the desynchronisation, but i have an idea to solve it.
    If you set NavMeshAgent.updatePosition to false, then the navmeshagent will not take the character with it when it moves.

    Then you can use the NavMeshAgent.Move command, to move the agent into where it needs to be.
    That command applies some motion to the agent, i'm not sure if it's ongoing or only for a single frame, but play around with it