private static void DetectSceneDeletion(string[] deletedAssets)
 {
     foreach (string assetPath in deletedAssets)
     {
         if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension &&
             !TypedSceneValidator.ValidateSceneDeletion(Path.GetFileNameWithoutExtension(assetPath)))
         {
             TypedSceneStorage.Delete(Path.GetFileNameWithoutExtension(assetPath));
         }
     }
 }
Exemple #2
0
 private static void DetectSceneDeletion(string[] deletedAssets)
 {
     foreach (string assetPath in deletedAssets)
     {
         if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension &&
             !TypedSceneValidator.ValidateSceneDeletion(Path.GetFileNameWithoutExtension(assetPath)))
         {
             var newSceneList = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes);
             newSceneList.RemoveAll(scene => scene.path == assetPath);
             EditorBuildSettings.scenes = newSceneList.ToArray();
             TypedSceneStorage.Delete(Path.GetFileNameWithoutExtension(assetPath));
         }
     }
 }
 private static void DetectSceneImport(string[] importedAssets)
 {
     foreach (string assetPath in importedAssets)
     {
         if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension &&
             TypedSceneValidator.ValidateSceneImport(assetPath))
         {
             var name       = Path.GetFileNameWithoutExtension(assetPath);
             var guid       = AssetDatabase.AssetPathToGUID(assetPath);
             var sourceCode = TypedSceneGenerator.Generate(name, guid);
             TypedSceneStorage.Save(name, sourceCode);
         }
     }
 }
Exemple #4
0
        private static void DetectSceneMovement(string[] movedAssets, string[] movedFromAssetPaths)
        {
            for (var i = 0; i < movedFromAssetPaths.Length; i++)
            {
                if (Path.GetExtension(movedFromAssetPaths[i]) == TypedSceneSettings.SceneExtension)
                {
                    var oldName = Path.GetFileNameWithoutExtension(movedFromAssetPaths[i]);
                    var newName = Path.GetFileNameWithoutExtension(movedAssets[i]);

                    if (oldName != newName)
                    {
                        TypedSceneStorage.Delete(oldName);
                    }
                }
            }
        }
Exemple #5
0
 private static void DetectSceneImport(string[] importedAssets)
 {
     foreach (string assetPath in importedAssets)
     {
         if (Path.GetExtension(assetPath) == TypedSceneSettings.SceneExtension &&
             TypedSceneValidator.ValidateSceneImport(assetPath))
         {
             var name       = Path.GetFileNameWithoutExtension(assetPath);
             var sourceCode = TypedSceneGenerator.Generate(name, name, AssetDatabase.AssetPathToGUID(assetPath));
             var guid       = AssetDatabase.AssetPathToGUID(assetPath);
             if (!EditorBuildSettings.scenes.Any(scene => scene.guid.ToString() == guid))
             {
                 var newSceneList = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes);
                 newSceneList.Add(new EditorBuildSettingsScene(assetPath, true));
                 EditorBuildSettings.scenes = newSceneList.ToArray();
             }
             TypedSceneStorage.Save(name, sourceCode);
         }
     }
 }