ScriptableObjectInstantiator.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #if UNITY_EDITOR
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Resources;
  6. using System.Text;
  7. using UnityEditor;
  8. using UnityEngine;
  9. namespace TheraBytes.BetterUi
  10. {
  11. public static class ScriptableObjectInstantiator
  12. {
  13. [MenuItem("Tools/Better UI/Settings/Select Resolution Monitor", false, 0)]
  14. static void SelectResolutionMonitor()
  15. {
  16. Selection.objects = new UnityEngine.Object[] { ResolutionMonitor.Instance };
  17. }
  18. [MenuItem("Tools/Better UI/Settings/Select Material Definitions", false, 1)]
  19. static void SelectMaterials()
  20. {
  21. Selection.objects = new UnityEngine.Object[] { Materials.Instance };
  22. }
  23. [MenuItem("Tools/Better UI/Settings/Ensure Singleton Resources", false, 30)]
  24. static void ManualInitialize()
  25. {
  26. if (ResolutionMonitor.HasInstance && Materials.HasInstance)
  27. {
  28. Debug.Log("Instances already present. Please Check \"Assets/Thera Bytes/Resources\"");
  29. return;
  30. }
  31. ResolutionMonitor.EnsureInstance();
  32. Materials.EnsureInstance();
  33. Debug.Log("Instances have been created. Please Check \"Assets/Thera Bytes/Resources\"");
  34. }
  35. }
  36. }
  37. #endif