BuildNavMesh() private method

private BuildNavMesh ( ) : void
return void
コード例 #1
0
 /// <summary>
 ///   <para>Builds the combined navmesh for the contents of multiple scenes.</para>
 /// </summary>
 /// <param name="paths">Array of paths to scenes that are used for building the navmesh.</param>
 public static void BuildNavMeshForMultipleScenes(string[] paths)
 {
     if (paths.Length == 0)
     {
         return;
     }
     for (int index1 = 0; index1 < paths.Length; ++index1)
     {
         for (int index2 = index1 + 1; index2 < paths.Length; ++index2)
         {
             if (paths[index1] == paths[index2])
             {
                 throw new Exception("No duplicate scene names are allowed");
             }
         }
     }
     if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
     {
         return;
     }
     if (!EditorSceneManager.OpenScene(paths[0]).IsValid())
     {
         throw new Exception("Could not open scene: " + paths[0]);
     }
     for (int index = 1; index < paths.Length; ++index)
     {
         EditorSceneManager.OpenScene(paths[index], OpenSceneMode.Additive);
     }
     NavMeshBuilder.BuildNavMesh();
     UnityEngine.Object sceneNavMeshData = NavMeshBuilder.sceneNavMeshData;
     for (int index = 0; index < paths.Length; ++index)
     {
         if (EditorSceneManager.OpenScene(paths[index]).IsValid())
         {
             NavMeshBuilder.sceneNavMeshData = sceneNavMeshData;
             EditorSceneManager.SaveScene(SceneManager.GetActiveScene());
         }
     }
 }
コード例 #2
0
ファイル: NavMeshBuilder.cs プロジェクト: wensincai/Unity5.4
 public static void BuildNavMeshForMultipleScenes(string[] paths)
 {
     if (paths.Length == 0)
     {
         return;
     }
     for (int i = 0; i < paths.Length; i++)
     {
         for (int j = i + 1; j < paths.Length; j++)
         {
             if (paths[i] == paths[j])
             {
                 throw new Exception("No duplicate scene names are allowed");
             }
         }
     }
     if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
     {
         return;
     }
     if (!EditorSceneManager.OpenScene(paths[0]).IsValid())
     {
         throw new Exception("Could not open scene: " + paths[0]);
     }
     for (int k = 1; k < paths.Length; k++)
     {
         EditorSceneManager.OpenScene(paths[k], OpenSceneMode.Additive);
     }
     NavMeshBuilder.BuildNavMesh();
     UnityEngine.Object sceneNavMeshData = NavMeshBuilder.sceneNavMeshData;
     for (int l = 0; l < paths.Length; l++)
     {
         if (EditorSceneManager.OpenScene(paths[l]).IsValid())
         {
             NavMeshBuilder.sceneNavMeshData = sceneNavMeshData;
             EditorSceneManager.SaveScene(SceneManager.GetActiveScene());
         }
     }
 }