編輯

共用方式為


EditorSceneUtils Class

Definition

Utilities for loading / saving scenes in editor via SceneInfo. Because SceneInfo is defined in MixedRealityToolkit, this can't be kept in Editor utilities.

public ref class EditorSceneUtils abstract sealed
public static class EditorSceneUtils
type EditorSceneUtils = class
Public Class EditorSceneUtils
Inheritance
EditorSceneUtils

Methods

AddSceneToBuildSettings(SceneInfo, EditorBuildSettingsScene[], EditorSceneUtils+BuildIndexTarget)

Adds scene to build settings.

CheckBuildSettingsForDuplicates(List<SceneInfo>, Dictionary<String,List<Int32>>)

Checks build settings for possible errors and displays warnings.

CopyLightingSettingsToActiveScene(Scene)

Copies the lighting settings from the lighting scene to the active scene

CreateAndSaveScene(String, String)

Creates a new scene with sceneName and saves to path.

EnforceSceneComponents(Scene, IEnumerable<Type>, List<Component>)

Goes through a scene's objects and checks for components that aren't found in permittedComponentTypes If any are found, they're added to the violations list.

GetLightingAndRenderSettings(SerializedObject, SerializedObject)

Gets serialized objects for lightmap and render settings from active scene.

GetRootGameObjectsInLoadedScenes()

Returns all root GameObjects in all open scenes.

GetSceneBuildIndex(GUID, List<EditorBuildSettingsScene>)

Gets the build index for a scene GUID. There are many ways to do this in Unity but this is the only 100% reliable method I know of.

GetSceneIfLoaded(SceneInfo, Scene)

Finds the scene if loaded.

IsEditingPrefab()

Returns true if user is currently editing a prefab.

LoadScene(SceneInfo, Boolean, Scene)

Attempts to load scene in editor using a scene object reference.

SetActiveScene(Scene)

Attempts to set the active scene and catches all the various ways it can go wrong. Returns true if successful.

UnloadScene(SceneInfo, Boolean)

Unloads a scene in the editor and catches any errors that can happen along the way.

Applies to