// ReSharper disable once UnusedMember.Local private void OnEnable() { m_T = (SceneCollection)target; m_GetTarget = new SerializedObject(m_T); m_SceneReferenceProperty = m_GetTarget.FindProperty("SceneAssets"); m_Name = m_GetTarget.FindProperty("CollectionName"); m_TransitionScene = m_GetTarget.FindProperty("TransitionScene"); m_List = new ReorderableListLayout(m_GetTarget, m_SceneReferenceProperty, r_DefaultSettings); DrawElementList(); OnSelected(); if (r_DefaultSettings.DisplayHeader) { OnHeader(); } if (r_DefaultSettings.DisplayAddButton) { OnAdd(); } if (r_DefaultSettings.DisplayRemoveButton) { OnRemove(); } }
// Update is called once per frame public void OnGUI() { //Texture2D t = EditorGUIUtility.Load("Icons/UnityEditor.DebugInspectorWindow.png") as Texture2D; GUILayout.Label("UnityTools @SceneManagement"); if (GUILayout.Button("Create SceneManagerProfile")) { Utils.CreateAndRenameAsset <SceneManagerProfile>(); } if (GUILayout.Button("Create SceneCollection")) { SceneCollection sc = Utils.CreateAndRenameAsset <SceneCollection>(); for (int i = 0; i < EditorSceneManager.loadedSceneCount; i++) { string path = EditorSceneManager.GetSceneAt(i).path; var sa = AssetDatabase.LoadAssetAtPath <SceneAsset>(path); sc.SceneAssets.Add(sa); sc.SceneReferences.Add(AssetDatabase.GetAssetPath(sa)); sc.AddToBuild(sa); } } }