CustomModelConfig.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEditor;
  2. using UnityEngine;
  3. namespace FL.Editor.Imports
  4. {
  5. [System.Serializable]
  6. public struct PathValues
  7. {
  8. [Header("外部相对路径")]
  9. [Tooltip("customModelsPath的子文件夹")]
  10. public string from;
  11. [Header("目标文件夹")]
  12. public string to;
  13. }
  14. /// <summary>
  15. /// 导入外部模型的配置文件
  16. /// </summary>
  17. [CreateAssetMenu(fileName = "CustomModelConfig", menuName = "XGame/模型导入配置")]
  18. public class CustomModelConfig : ScriptableObject
  19. {
  20. [Header("外部模型根目录")]
  21. public string customModelsPath;
  22. public PathValues[] paths;
  23. #region 静态方法
  24. public static CustomModelConfig Load()
  25. {
  26. var guids = AssetDatabase.FindAssets(typeof(CustomModelConfig).Name);
  27. if (guids.Length == 0)
  28. return null;
  29. var assetPath = AssetDatabase.GUIDToAssetPath(guids[0]);
  30. return AssetDatabase.LoadAssetAtPath<CustomModelConfig>(assetPath);
  31. }
  32. #endregion
  33. }
  34. }