Search Unity

When are navmeshes loaded into memory/Any way to unload them?

Discussion in 'Navigation' started by GoGoGadget, Apr 20, 2015.

  1. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Hi,

    Can't seem to find any particular info on this, wondering if a scene's navmesh is automatically loaded into memory on scene load, and if so, what the correct way to "unload" a navmesh is.
    At the moment, I want my server instance of my game to be the only one calculating the pathfinding, so if possible, I'd like to avoid having all clients load in an unused 200MB navmesh.

    Cheers
     
  2. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    Yes currently the navmesh data is stored 1-to-1 with the scene. As the scene is (un)loaded so is the navmesh.
    If you want a server only to access the navmesh data -- one option could be to have the navmesh baked into a separate scene which (on the server only) is loaded using LoadLevelAdditive.
     
  3. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Hmm ok, so would there be any way for me just to create an empty scene and tell that scene to use the navmesh I baked in my main scene - eg. renaming files/anything like that? Or would I have to create a duplicate scene, bake the navmesh in that, then delete everything in it to get a scene with just the navmesh?
     
  4. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
    Depends - you could copy the scene - bake navmesh and remove scene contents.
    (although i would - dicouraged as it may be - make an empty scene and make it point to the navmesh data using a text editor).
     
    GoGoGadget likes this.
  5. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Just getting around to this now - not exactly sure how I go about pointing to the new scene with a text editor - can't seem to find anything obvious in either the meta/scene files of the navmesh or the scene?
     
  6. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    @Jakob_Unity Also, is any of this changing in 5.2? Really running into a huge roadblock with pathfinding at the moment, the inability to decouple the navmesh from the scene is creating some big issues (couldn't seem to find how to hack it with a text editor like you suggested) , paired with the fact that I'm running into a pretty serious limitation with the A* pathfinding project that also makes it unusable.