Search Unity

[SOLVED] UpdateNavMeshDataAsync is taking too much time per frame

Discussion in 'Navigation' started by DwinTeimlon, Aug 3, 2017.

  1. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    Hi there,

    using UpdateNavMeshDataAsync is not useable for me, as it takes far too much time per frame (game stutters when I call it). It would be great if we could set an amount of milliseconds per frame to prevent this.

    I am not even changing the nav mesh itself, I am just changing a small amount of navmesh area settings, e.g. an fire destroyed a forest and now this area has cheaper walking costs.

    Any chance of adding this in the future @Jakob_Unity or am I doing anything wrong?
     
  2. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
  3. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
  4. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    Check my linked post. I was able to reduce the ms per frame to a very small amount by overriding the navmesh settings.
     
    DwinTeimlon likes this.
  5. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    Thanks I have played around with this setting already, but it doesn't help. I have to set the voxel size to 0.08 for my navmesh to make it work, otherwise navagent would be "floating" and not be on the ground. I don't use a normal terrain but tiles which I create in magica voxel. Some of those tiles have lot's of "steps" which need a decent voxel resolution to generate the navmesh. I would understand if this takes some time in generating.

    The problem I have is that I want only change the cost for certain areas on the fly. As I have a burning forest which should be avoided for the time it's burning. It seems that the navmesh updates everything not only the costs, otherwise this sould be really fast imho.
     
  6. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    I have been scanning the improvement notes of the latest beta 2017.2b10 and found this:

    AI: Improved performance when synchronizing NavMesh tiles after carving.

    Installed it and it actually fixed my problem! Thanks so much @Unity! :D