Search Unity

Question Detect if NavMesh baking failed

Discussion in 'Navigation' started by Kati7, Jan 30, 2023.

  1. Kati7

    Kati7

    Joined:
    Nov 22, 2019
    Posts:
    1
    Hey Guys,
    I‘m trying to detect if my game failed to (re)bake the NavMesh. The NavMesh is baked on runtime via the following function:


    Code (CSharp):
    1. private void CalcNavMesh()
    2.         {
    3.             LogMsg($"Calculate NavMesh");
    4.             for (int i = 0; i < m_surfaces.Length; i++)
    5.             {
    6.                 m_surfaces[i].BuildNavMesh();
    7.             }
    8. //if building has failed do smth
    9.         }
    So, do you have any ideas how I could detect if the baking has failed?