2025-11-26 17:22:41 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
[InitializeOnLoad]
|
|
|
|
|
|
public static class CreatDomainDirectory
|
|
|
|
|
|
{
|
|
|
|
|
|
static CreatDomainDirectory()
|
|
|
|
|
|
{
|
|
|
|
|
|
// 注意 因为这个构造函数会被重复调用,
|
|
|
|
|
|
//所以为了防止quitting和update两个回调被重复添加,需要先移除后添加
|
|
|
|
|
|
EditorApplication.quitting -= OnEditorQuit;
|
|
|
|
|
|
EditorApplication.quitting += OnEditorQuit;
|
|
|
|
|
|
|
|
|
|
|
|
Debug.Log(" 自动运行 ");
|
|
|
|
|
|
|
2026-01-05 12:24:17 +08:00
|
|
|
|
if (!EditorPrefs.HasKey("ARMaz_StartUp"))
|
2025-11-26 17:22:41 +08:00
|
|
|
|
{
|
|
|
|
|
|
// 通过标记记录是否已经执行过该方法
|
|
|
|
|
|
OnEditorStartUp();
|
2026-01-05 12:24:17 +08:00
|
|
|
|
EditorPrefs.SetInt("ARMaz_StartUp", 1);
|
|
|
|
|
|
if (EditorPrefs.GetInt("ARMaz_CreatDomainDirectory") == 0)
|
2025-11-26 17:22:41 +08:00
|
|
|
|
{
|
2026-01-05 12:24:17 +08:00
|
|
|
|
EditorPrefs.SetInt("ARMaz_CreatDomainDirectory", 1);
|
2025-11-26 17:22:41 +08:00
|
|
|
|
bool isOk = EditorUtility.DisplayDialog("提示", "发现目录存在缺失,是否检索并创建缺失目录", "是", "否");
|
|
|
|
|
|
if (isOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
var DomainAll = EvoArtFolderCreator.RefreshModuleList();
|
|
|
|
|
|
foreach (var domain in DomainAll)
|
|
|
|
|
|
{
|
|
|
|
|
|
EvoArtFolderCreator.CreateFolders(domain);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// UnityEditor 关闭时取消标记
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private static void OnEditorQuit()
|
|
|
|
|
|
{
|
2026-01-05 12:24:17 +08:00
|
|
|
|
EditorPrefs.DeleteKey("ARMaz_StartUp");
|
2025-11-26 17:22:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 只会在UnityEditor启动时执行一次
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
static void OnEditorStartUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log(" UnityEditor 启动 ");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|