Search Unity

  1. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  2. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  3. Unity 2017.1 is now released.
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  6. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

Bad FPS spikes with NavMesh building at runtime

Discussion in 'Navigation' started by JohnTomorrow, Aug 12, 2017 at 7:10 PM.

  1. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    20
    Hey was wondering what can be done about FPS spikes when rebuilding a navmesh at runtime. When the meshes are built there is a horrible spike in the Camera.Render in the NavMesh.TileMesh call (greater than 200ms). I am building a graph 200x200x200 around the player as any smaller would be pretty useless. I have cached all the sources which hugely fixed all the other performance problems. Any insight in what the engine is doing or any plans to optimize this further on the engine side? Would really like to roll this feature out in our live game but this is kinda a deal breaker.
     

    Attached Files:

  2. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    20
    Overwrote some of the navmesh settings and it has seemed to help a lot.

    Code (CSharp):
    1.  defaultBuildSettings.overrideVoxelSize = true;
    2. defaultBuildSettings.voxelSize = 0.25f;
    3. defaultBuildSettings.overrideTileSize = true;
    4. defaultBuildSettings.tileSize = 64;
    This should probably be part of the example code...