public void AddScenesToBuildSettings() { List <string> fullPathScenes = new List <string>(); foreach (string sceneName in requiredExampleScenes) { string sceneFullPath = EditorTools.GetSceneFullPath(sceneName); fullPathScenes.Add(sceneFullPath); } foreach (string fullPath in fullPathScenes) { if (!EditorTools.IsSceneInBuildSettings(fullPath)) { EditorTools.AddSceneToBuildSettings(fullPath); } } }
public override void OnInspectorGUI() { valid = true; assetsList.DoLayoutList(); if (!Application.isPlaying && !valid) { EditorGUILayout.HelpBox("Some of the selected scenes for this GameState are not added to the Build Settings.", MessageType.Error); if (GUILayout.Button("Add Scenes to BuildSettings")) { foreach (var sc in cTarget.scenes) { string scName = EditorTools.TrimmSceneExtension(sc.scene); if (!enabledScenes.Contains(scName)) { EditorTools.AddSceneToBuildSettings(scName); } } } OnEnable(); } }