コード例 #1
0
    static ImportSettingData()
    {
        // 加载配置文件
        Setting = AssetDatabase.LoadAssetAtPath <ImportSetting>(EditorDefine.ImporterSettingFilePath);
        if (Setting == null)
        {
            Debug.LogWarning($"Create new ImportSetting.asset : {EditorDefine.ImporterSettingFilePath}");
            Setting = ScriptableObject.CreateInstance <ImportSetting>();
            EditorTools.CreateFileDirectory(EditorDefine.ImporterSettingFilePath);
            AssetDatabase.CreateAsset(Setting, EditorDefine.ImporterSettingFilePath);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        else
        {
            Debug.Log("Load ImportSetting.asset ok");
        }

        // Clear
        CacheTypes.Clear();
        CacheProcessor.Clear();

        // 获取所有资源处理器类型
        List <Type> result = AssemblyUtility.GetAssignableTypes(typeof(IAssetProcessor));

        for (int i = 0; i < result.Count; i++)
        {
            Type type = result[i];
            if (CacheTypes.ContainsKey(type.Name) == false)
            {
                CacheTypes.Add(type.Name, type);
            }
        }
    }
コード例 #2
0
 static BuildSettingData()
 {
     // 加载配置文件
     Setting = AssetDatabase.LoadAssetAtPath <BuildSetting>(EditorDefine.BuilderSettingFilePath);
     if (Setting == null)
     {
         Debug.LogWarning($"Create new BuildSetting.asset : {EditorDefine.BuilderSettingFilePath}");
         Setting = ScriptableObject.CreateInstance <BuildSetting>();
         EditorTools.CreateFileDirectory(EditorDefine.BuilderSettingFilePath);
         AssetDatabase.CreateAsset(Setting, EditorDefine.BuilderSettingFilePath);
         AssetDatabase.SaveAssets();
         AssetDatabase.Refresh();
     }
     else
     {
         Debug.Log("Load BuildSetting.asset ok");
     }
 }