Bake() private method

private Bake ( ) : bool
return bool
示例#1
0
 public static void BakeMultipleScenes(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 duplication of scenes is allowed");
             }
         }
     }
     if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
     {
         return;
     }
     SceneSetup[] sceneManagerSetup = EditorSceneManager.GetSceneManagerSetup();
     EditorSceneManager.OpenScene(paths[0]);
     for (int k = 1; k < paths.Length; k++)
     {
         EditorSceneManager.OpenScene(paths[k], OpenSceneMode.Additive);
     }
     Lightmapping.Bake();
     EditorSceneManager.SaveOpenScenes();
     EditorSceneManager.RestoreSceneManagerSetup(sceneManagerSetup);
 }
示例#2
0
 /// <summary>
 ///   <para>Bakes an array of scenes.</para>
 /// </summary>
 /// <param name="paths">The path of the scenes that should be baked.</param>
 public static void BakeMultipleScenes(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 duplication of scenes is allowed");
             }
         }
     }
     if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
     {
         return;
     }
     SceneSetup[] sceneManagerSetup = EditorSceneManager.GetSceneManagerSetup();
     EditorSceneManager.OpenScene(paths[0]);
     for (int index = 1; index < paths.Length; ++index)
     {
         EditorSceneManager.OpenScene(paths[index], OpenSceneMode.Additive);
     }
     Lightmapping.Bake();
     EditorSceneManager.SaveOpenScenes();
     EditorSceneManager.RestoreSceneManagerSetup(sceneManagerSetup);
 }