Search Unity

Bug NavMeshData lossy ? NavMeshSurface reseting for prefab with it

Discussion in 'Navigation' started by edin97, Jan 24, 2023.

  1. edin97

    edin97

    Joined:
    Aug 9, 2021
    Posts:
    58
    Hello,

    I'm making a game using a NavMeshAgent. I have 2 NavMeshSurface (1 different agent type each) on 2 planes with mulitple NavMeshModifierVolume(s), which is one prefab. I am scared to open that prefab to make changes, because there is a probability, idk how or why, that my NavMeshSurface just resets and my player obviously can't move after pressing play/testing. The issue is 100% with opening the prefab (not even saving/changing something) but doesn't happen every time, it's just random.

    It's been 1 year now maybe. When it resets, I can't bake it from the prefab. I need to instantiate it in a scene and clear/bake, with again, a probability for it to work or not... Even though it shows the navmesh correctly drawn, I can't Override the prefab or anything, and it's just a gamble Clearing/Baking until it works ... I can go HOURS doing this. I don't have time to waste with this anymore, I can't be clearing/baking for 3 hours every few month ...

    This is my "prefab" :
    upload_2023-1-24_21-42-49.png
    The NavMeshSurface is correct after baking, but if I go in game :
    upload_2023-1-24_21-44-30.png
    Information is lost, because it's just luck .. Ex : NavMeshTeam1 worked but NavMeshTeam0 didn't ..

    Also, it keeps creating all these NavMeshData files when I try to change parameters, which I don't know how to use or what to do with them, can I retrieve the data from them somehow ? (from a working NavMeshData)

    upload_2023-1-24_21-24-53.png

    Hopefully someone can get me out of this mess... Thanks in advance
     

    Attached Files:

    Last edited: Jan 24, 2023
  2. edin97

    edin97

    Joined:
    Aug 9, 2021
    Posts:
    58
    I forgot the debug mode existed for the inspector window !

    Switching to debug shows that in fact the NavMeshData is lost :

    upload_2023-1-25_17-28-37.png

    And looking through all the NavMeshData files I have, the NavMeshData (22) is the correct one, but it goes to (23) duplicates of this asset. So I'm guessing it just created a 23rd and assigned it after I left the prefab and then lost it somehow, which results in No NavMeshData, but idk.

    I can't replicate the bug tbh, like I said it feels like luck. Now that I can fix it by dragging the correct NavMeshData, I tried replicating by opening the prefab multiple time etc.. but the data is still there...

    If someone has the same issue

    1. you can click on your GameObject with NavMeshSurface component and switch to debug :
    upload_2023-1-25_17-42-44.png

    2. Then you search for the name of that GameObject in your Project tab, i.e. mine is NavMeshTeam0 so I searched that. You'll get all the NavMeshData files and you can now test which one works by drag and dropping them in the NavMeshData variable.
     
    Last edited: Jan 25, 2023
  3. Mithrandir01

    Mithrandir01

    Joined:
    Jan 22, 2020
    Posts:
    3
    I have the same bug using a naviagation surface