BuildMenuData.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Magica Cloth.
  2. // Copyright (c) MagicaSoft, 2020-2022.
  3. // https://magicasoft.jp
  4. using UnityEditor;
  5. using UnityEngine;
  6. namespace MagicaCloth
  7. {
  8. /// <summary>
  9. /// 設定データ
  10. /// </summary>
  11. [System.Serializable]
  12. public class BuildMenuData
  13. {
  14. const string SettingDataSaveName = "MagicaClothBuildSettings";
  15. //=========================================================================================
  16. // Target Object
  17. public int TargetMode = 1; // 0 = all, 1 = selected
  18. public bool Prefab = true;
  19. public bool Scene = true;
  20. //=========================================================================================
  21. // Target Components
  22. public bool BoneCloth = true;
  23. public bool BoneSpring = true;
  24. public bool MeshCloth = true;
  25. public bool MeshSpring = true;
  26. public bool RenderDeformer = true;
  27. public bool VirtualDeformer = true;
  28. //=========================================================================================
  29. // Build Conditions
  30. public bool ForceBuild = false;
  31. public bool NotCreated = true;
  32. public bool UpgradeFormatAndAlgorithm = true;
  33. public bool VerificationOnly = false;
  34. //=========================================================================================
  35. // Options
  36. public bool ErrorStop = false;
  37. //=========================================================================================
  38. /// <summary>
  39. /// 設定データをロード
  40. /// </summary>
  41. public void Load()
  42. {
  43. if (EditorPrefs.HasKey(SettingDataSaveName))
  44. {
  45. var data = EditorPrefs.GetString(SettingDataSaveName, JsonUtility.ToJson(this, false));
  46. JsonUtility.FromJsonOverwrite(data, this);
  47. }
  48. }
  49. /// <summary>
  50. /// 設定データを保存
  51. /// 設定データはPCごとに保存される(Windowsの場合はレジストリ)
  52. /// </summary>
  53. public void Save()
  54. {
  55. var data = JsonUtility.ToJson(this, false);
  56. EditorPrefs.SetString(SettingDataSaveName, data);
  57. }
  58. }
  59. }