public static bool OnOpenSceneSet(int instanceID, int line) { Object unityObject = EditorUtility.InstanceIDToObject(instanceID); if (unityObject?.GetType() == typeof(SceneSet)) { SceneSet targetSet = unityObject as SceneSet; if (targetSet.SetScenes.Count == 0) { return(true); } int loadMode = EditorUtility.DisplayDialogComplex("Load Scene Set", "Select load mode.", "Full", "Additive (Keep Current Scenes)", "Cancel"); if (loadMode == 0) { targetSet.LoadSceneSet(false); } else if (loadMode == 1) { targetSet.LoadSceneSet(true); } return(true); } return(false); }
public static void CreateSceneSetFromScene() { SceneSet newSceneSet = CreateInstance <SceneSet>(); SceneField newSceneField = new SceneField { SceneAsset = Selection.activeObject, SceneName = Selection.activeObject.name }; newSceneSet.SetScenes.Add(newSceneField); AssetDatabase.CreateAsset(newSceneSet, AssetDatabase.GetAssetPath(Selection.activeObject) .Replace(".unity", " Scene Set.asset")); AssetDatabase.Refresh(); Selection.activeObject = newSceneSet; }