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

Anyone else experiencing input lag with NavMeshAgent isStopped = false method for movement?

Discussion in 'Navigation' started by CarterG81, Oct 10, 2017.

  1. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I asked over at Unity Answers how to resolve a problem with a 100ms input lag from when I declare NavMeshAgent.isStopped = false & the player actually beginning movement.

    This is very noticeable, but I also verified it with System.Diagnostics.Stopwatch. It varies from 50 to 100ms, but is nearly always noticeable when I play. It's unacceptable input lag.

    Does anyone else notice this input lag when using NavMeshAgent.UpdatePosition = true & letting it all handle itself automatically?
     
  2. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I'd still like to know if other users are reporting any input lag. (I might be doing something wrong with my navmeshsurface generation.)

    I figured out why I'm getting the lag though. The path is taking too long to finish calculating. Even though it's an extremely simple straight line with no obstacles, it is taking too long.

    If others don't get this input lag, then perhaps I could figure out WHY my SetDestination(position) is taking so long to calculate.
     
  3. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    You could try to increase NavMesh.pathfindingIterationsPerFrame to make sure your path is calculated faster or use NavMeshAgent.CalculatePath to get the path immediately.
     
    CarterG81 likes this.
  4. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I switched to A* Pathfinding Project and within 1 hour got to where I was 15hrs with Unity. Without any performance problems.

    I strongly recommend A * Pathfinding Project. Free or Pro.
     
  5. JoeBarbaro244

    JoeBarbaro244

    Joined:
    Jan 29, 2018
    Posts:
    1
    Oy did your multiplayer game work? https://forum.unity.com/threads/think-twice-before-adding-multiplayer-to-your-game.392926/ I want some advice from you.
     
  6. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
  7. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Somehow whenever I run into you @CarterG81 it seems to be to bemoan how awful Unity's implementation of certain features are. Last time it was UNet. Not saying you're wrong, to be clear ;p
     
    CarterG81 likes this.
  8. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Yea, that makes sense. I'm not a fanboy at all, so I just tell it like it is. Unity's stuff is pretty awful on quite a consistent basis.
    I mean, just look at the now defunct UNET. Even Unity thought it was so awful it wasn't even worth fixing.

    I only use Unity for the Asset Store, which means I literally use Unity for everything that isn't developed by Unity Technologies. Even Unity itself hires/absorbs the asset developers instead of doing things themselves. That's kind of their thing. Almost like they know their own work is always awful so they jump to the idea of letting someone else fix it. It's weird.
     
    Last edited: Nov 16, 2018