private void AddScene()
        {
            if (HasSceneName() == true)
            {
                Debug.LogError("Scene Name Is Required");
                return;
            }

            GameLevelToolkitWindow toolkit = GameLevelToolkitWindow.GetRefreshedToolkitWindow();
            string targetSceneFolderPath   = GameLevelToolkitWindow.GetProjectPathStringWithSlash();


            //Check If scene Already Exists
            string targetSceneFile = "Assets/" + targetSceneFolderPath + "Scenes/" + targetSceneFolderPath + SceneAndResourceFolderName.folderNameValue + "/" + selectedGameLevel.gameLevelName + "_" + sceneNameToCreate + ".unity";

            if (System.IO.File.Exists(targetSceneFile))
            {
                Debug.LogError("Scene Already Exists");
                return;
            }

            CreateScene.CreateEmptyScene(selectedGameLevel.gameLevelName + "_" + sceneNameToCreate, selectedGameLevel.gameLevelName);

            selectedGameLevel.assignedScenes.Add(sceneNameToCreate);
            EditorUtility.SetDirty(selectedGameLevel);

            if (automaticallyAddSceneToBuild == true)
            {
                List <EditorBuildSettingsScene> editorBuildSettingsScenes = new List <EditorBuildSettingsScene>();

                //Get The Existing Build List
                foreach (EditorBuildSettingsScene item in EditorBuildSettings.scenes)
                {
                    editorBuildSettingsScenes.Add(item);
                }

                EditorBuildSettingsScene editorScene = new EditorBuildSettingsScene(targetSceneFile, true);

                if (editorBuildSettingsScenes.Count > 0)
                {
                    bool masterSceneNotFoundInBuild = false;
                    for (int i = 0; i < editorBuildSettingsScenes.Count; i++)
                    {
                        if (editorBuildSettingsScenes[i].path == editorScene.path)
                        {
                            masterSceneNotFoundInBuild = true;
                            break;
                        }
                    }
                    if (masterSceneNotFoundInBuild == false)
                    {
                        editorBuildSettingsScenes.Add(editorScene);
                    }
                }

                EditorBuildSettings.scenes = editorBuildSettingsScenes.ToArray();
            }

            OpenGameLevel.OpenLevel(selectedGameLevel, true, false, true);
        }
        private void CreateLevel()
        {
            GameLevelToolkitWindow toolkit = GameLevelToolkitWindow.GetRefreshedToolkitWindow();
            string projectPathName         = GameLevelToolkitWindow.GetProjectPathStringWithSlash();

            //Check If the Location Already Exists
            GameLevel existingLocation = (GameLevel)AssetDatabase.LoadAssetAtPath("Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue + "/" + gameLevelName + "/" + gameLevelName + ".asset", typeof(GameLevel));

            if (existingLocation != null)
            {
                Debug.LogError("Level With Same Name Already Exists");
                return;
            }

            //First We Will need to make sure we have all the required data before proceeding
            if (gameLevelName == null || gameLevelName == "")
            {
                Debug.LogError("Level Name Cannot Be Empty");
                return;
            }

            //Check If Any Scene Names are empty
            for (int i = 0; i < scenesToCreateInGameLevel.Count; i++)
            {
                if (scenesToCreateInGameLevel[i].VerifySceneNameIsNotEmpty() == true)
                {
                    Debug.LogError("Scene Name Cannot Be Empty");
                    return;
                }
            }

            for (int i = 0; i < scenesToCreateInGameLevel.Count; i++)
            {
                string sceneDirectory = gameLevelName;
                CreateScene.CreateEmptyScene(gameLevelName + "_" + scenesToCreateInGameLevel[i].sceneName, sceneDirectory);
            }

            //Create the Location Resources
            string resourceFolder = AssetDatabase.CreateFolder("Assets/" + projectPathName + "Resources/Locations", gameLevelName);
            string newFolderPath  = AssetDatabase.GUIDToAssetPath(resourceFolder);

            //Check Does FolderExist To Place Resource File Inside
            if (!Directory.Exists("Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue + "/Existing " + SceneAndResourceFolderName.folderNameValue))
            {
                AssetDatabase.CreateFolder("Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue, "Existing " + SceneAndResourceFolderName.folderNameValue);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }

            GameLevel gameLevelResource = GameLevelData.CreateInstance <GameLevel>();

            AssetDatabase.CreateAsset(GameLevel.CreateInstance <GameLevel>(), "Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue + "/Existing " + SceneAndResourceFolderName.folderNameValue + "/" + gameLevelName + ".asset");
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();


            GameLevel createdGameLevel = (GameLevel)AssetDatabase.LoadAssetAtPath("Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue + "/Existing " + SceneAndResourceFolderName.folderNameValue + "/" + gameLevelName + ".asset", typeof(GameLevel));

            createdGameLevel.gameLevelName           = gameLevelName;
            createdGameLevel.assignedScenesDirectory = "Assets/" + projectPathName + "Scenes/" + SceneAndResourceFolderName.folderNameValue + "/" + gameLevelName;
            createdGameLevel.assignedCategory        = categories[selectedCategoryValue];
            GameLevelToolkitWindow.GetGameLevelsData().gameLevelsCreatedByUser.Add(createdGameLevel);
            EditorUtility.SetDirty(createdGameLevel);

            for (int i = 0; i < scenesToCreateInGameLevel.Count; i++)
            {
                createdGameLevel.assignedScenes.Add(scenesToCreateInGameLevel[i].sceneName);
            }

            for (int i = 0; i < gameLevelDependencies.Count; i++)
            {
                createdGameLevel.levelDependencies.Add(gameLevelDependencies[i]);
            }
            EditorUtility.SetDirty(toolkit.gameLevelsData);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            OpenGameLevel.OpenLevel(createdGameLevel, true, false, true);

            if (addLevelToUnityBuildScenes == true)
            {
                BuildSettingsSceneManagement.AddLevelToBuild(createdGameLevel);
            }
        }
        private void CreateRequiredInitialData()
        {
            string projectPathName             = "";
            string projectPathNameWithoutSlash = "";

            GameLevelToolkitWindow toolkit = GetRefreshedToolkitWindow();

            if (toolkit.useRootProjectDirectoryPath == false)
            {
                projectPathName             = toolkit.projectDirectoryPathName + "/";
                projectPathNameWithoutSlash = toolkit.projectDirectoryPathName;
            }

            if (!Directory.Exists("Assets/" + projectPathName + "Resources"))
            {
                if (useRootProjectDirectoryPath == true)
                {
                    string resourcesDirectory = AssetDatabase.CreateFolder("Assets", "Resources");
                }
                else
                {
                    string resourcesDirectory = AssetDatabase.CreateFolder("Assets/" + projectPathNameWithoutSlash, "Resources");
                }
            }

            if (!Directory.Exists("Assets/" + projectPathName + "Scenes"))
            {
                if (useRootProjectDirectoryPath == true)
                {
                    string resourcesDirectory = AssetDatabase.CreateFolder("Assets", "Scenes");
                }
                else
                {
                    string resourcesDirectory = AssetDatabase.CreateFolder("Assets/" + projectPathNameWithoutSlash, "Scenes");
                }
            }

            if (!Directory.Exists("Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue))
            {
                //Create locationsResourceDirectory Directory
                string gameLevelsResourceDirectoryGuid = AssetDatabase.CreateFolder("Assets/" + projectPathName + "Resources", SceneAndResourceFolderName.folderNameValue);
                string gameLevelsResourceDirectoryPath = AssetDatabase.GUIDToAssetPath(gameLevelsResourceDirectoryGuid);
            }

            if (!Directory.Exists("Assets/" + projectPathName + "Scenes/" + SceneAndResourceFolderName.folderNameValue))
            {
                //Create Locations Directory in Scenes
                string gameLevelsScenesDirectory = AssetDatabase.CreateFolder("Assets/" + projectPathName + "Scenes", SceneAndResourceFolderName.folderNameValue);
            }

            //Create Game Levels Data
            string desiredGameLevelsDataDirectory = "Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue + "/" + SceneAndResourceFolderName.folderNameValue + " Data.asset";

            if (!Directory.Exists(desiredGameLevelsDataDirectory))
            {
                AssetDatabase.CreateAsset(GameLevelData.CreateInstance <GameLevelData>(), desiredGameLevelsDataDirectory);
            }

            //Create Game Levels Settings
            string desiredGameLevelsSettingsDirectory = "Assets/" + projectPathName + "Resources/" + SceneAndResourceFolderName.folderNameValue + "/" + SceneAndResourceFolderName.folderNameValue + " Settings.asset";

            if (!Directory.Exists(desiredGameLevelsSettingsDirectory))
            {
                AssetDatabase.CreateAsset(CreateInstance <GameLevelToolkitSettings>(), desiredGameLevelsSettingsDirectory);
            }
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            toolkit.gameLevelsData = Resources.Load(SceneAndResourceFolderName.folderNameValue + "/" + SceneAndResourceFolderName.folderNameValue + " Data") as GameLevelData;
            toolkit.settings       = Resources.Load(SceneAndResourceFolderName.folderNameValue + "/" + SceneAndResourceFolderName.folderNameValue + " Settings") as GameLevelToolkitSettings;
            toolkit.settings.useRootProjectDirectoryPath = toolkit.useRootProjectDirectoryPath;
            toolkit.settings.projectDirectoryPathName    = toolkit.projectDirectoryPathName;

            //Create Master Scene
            if (!Directory.Exists("Assets/" + projectPathName + "Scenes/" + SceneAndResourceFolderName.folderNameValue + "/MasterScene"))
            {
                //Create Master Scene Directory
                string dir         = AssetDatabase.CreateFolder("Assets/" + projectPathName + "Scenes/" + SceneAndResourceFolderName.folderNameValue, "Master Scene");
                Scene  masterScene = CreateScene.CreateEmptyScene("Master Scene", "Master Scene");
                EditorSceneManager.OpenScene("Assets/" + projectPathName + "Scenes/" + SceneAndResourceFolderName.folderNameValue + "/Master Scene/Master Scene.unity");
            }

            EditorUtility.SetDirty(toolkit.settings);
            EditorUtility.SetDirty(toolkit.gameLevelsData);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            EditorSceneManager.MarkAllScenesDirty();

            //Setup Master Scene
            Scene currentScene = SceneManager.GetActiveScene();
            // GameObject geo = new GameObject();
            GameObject go = new GameObject("Game Level Manager");

            go.AddComponent <GameLevelManager>();

            EditorSceneManager.SaveOpenScenes();

            BuildSettingsSceneManagement.AddMasterSceneToBuild();

            initialDataHasBeenCreated = true;
        }