コード例 #1
0
        private static void Upgrade()
        {
            var directoriesToDelete = new List <string>();
            var filesToDelete       = new List <string>();

            // Delete old pdb files - they are not needed. mdb files on their own works fine.
            if (Directory.Exists("Assets/" + SirenixAssetPaths.SirenixAssembliesPath))
            {
                filesToDelete.AddRange(new DirectoryInfo("Assets/" + SirenixAssetPaths.SirenixAssembliesPath).GetFiles("*.pdb", SearchOption.AllDirectories).Select(x => x.FullName));
            }

            // We no longer have Sirenix specific assets (Icon data are now embedded in the code)
            directoriesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixAssetsPath);

            // Demo packages are located directly in the demo folder -> All directories are old unpacked demos that needs to be deleted.
            if (Directory.Exists("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Demos"))
            {
                directoriesToDelete.AddRange(new DirectoryInfo("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Demos").GetDirectories().Select(x => x.FullName));
            }

            // Delete the upgrader itself (this script).
            filesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Odin Inspector/Scripts/Editor/OdinUpgrader.cs");

            // The getting started guide is no longer an asset.
            filesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Getting Started With Odin.asset");

            // The sample projects guide is no longer an asset.
            filesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Odin Inspector/Assets/Sample Projects.asset");

            // Delete the old wizard.
            filesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Odin Inspector/Scripts/Editor/OdinGettingStartedWizard.cs");

            // Odin Attributes Overview is renamed to Attributes Overview.
            filesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Demos/Odin Attributes Overview.unitypackage");

            // Custom Drawer Examples is renamed to Custom Drawers.
            filesToDelete.Add("Assets/" + SirenixAssetPaths.SirenixPluginPath + "Demos/Custom Drawer Examples.unitypackage");

            AssetDatabase.StartAssetEditing();
            try
            {
                DeleteDirsAndFiles(directoriesToDelete, filesToDelete);

                // Re-enabled editor only mode.
                if (EditorOnlyModeConfig.Instance.IsEditorOnlyModeEnabled())
                {
                    EditorOnlyModeConfig.Instance.EnableEditorOnlyMode(force: true);
                }
            }
            finally
            {
                AssetDatabase.StopAssetEditing();
            }

            // Open Getting Started window.
            OdinGettingStartedWindow.ShowWindow();
        }
コード例 #2
0
 private static void OpenGettingStarted()
 {
     OdinGettingStartedWindow.ShowWindow();
 }