AssetBundleBuilderSettingData.cs 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEditor;
  6. namespace YooAsset.Editor
  7. {
  8. public class AssetBundleBuilderSettingData
  9. {
  10. private static AssetBundleBuilderSetting _setting = null;
  11. public static AssetBundleBuilderSetting Setting
  12. {
  13. get
  14. {
  15. if (_setting == null)
  16. LoadSettingData();
  17. return _setting;
  18. }
  19. }
  20. /// <summary>
  21. /// 配置数据是否被修改
  22. /// </summary>
  23. public static bool IsDirty { set; get; } = false;
  24. /// <summary>
  25. /// 加载配置文件
  26. /// </summary>
  27. private static void LoadSettingData()
  28. {
  29. _setting = EditorHelper.LoadSettingData<AssetBundleBuilderSetting>();
  30. }
  31. /// <summary>
  32. /// 存储文件
  33. /// </summary>
  34. public static void SaveFile()
  35. {
  36. if (Setting != null)
  37. {
  38. IsDirty = false;
  39. EditorUtility.SetDirty(Setting);
  40. AssetDatabase.SaveAssets();
  41. Debug.Log($"{nameof(AssetBundleBuilderSetting)}.asset is saved!");
  42. }
  43. }
  44. }
  45. }