Ejemplo n.º 1
0
    private static void FindMissingScriptsInScenes(ref int missingCount)
    {
        EditorUtility.DisplayProgressBar("Searching scenes", "", 0.0f);

        if (EditorApplication.isPlaying)
        {
            FindMissingScriptsInScene(EditorSceneManager.GetActiveScene(), ref missingCount);
            FindMissingScriptsInScene(SceneUtils.GetDontDestroyOnLoadScene(), ref missingCount);
        }
        else
        {
            string currentScenePath = EditorSceneManager.GetActiveScene().path;

            string[] scenePaths = System.IO.Directory.GetFiles(Path.Combine(Application.dataPath, SCENES_FOLDER_PATH), "*.unity", System.IO.SearchOption.AllDirectories);
            foreach (var scenePath in scenePaths)
            {
                Scene scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
                FindMissingScriptsInScene(scene, ref missingCount);
            }
            EditorSceneManager.OpenScene(currentScenePath, OpenSceneMode.Single);
        }
    }