TMP_ProjectTextSettings.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #if !UNITY_2018_3_OR_NEWER
  2. using UnityEditor;
  3. namespace TMPro
  4. {
  5. public static class TMP_ProjectTextSettings
  6. {
  7. // Open Project Text Settings
  8. [MenuItem("Edit/Project Settings/TextMeshPro Settings", false, 309)]
  9. public static void SelectProjectTextSettings()
  10. {
  11. TMP_Settings textSettings = TMP_Settings.instance;
  12. if (textSettings)
  13. {
  14. Selection.activeObject = textSettings;
  15. // TODO: Do we want to ping the Project Text Settings asset in the Project Inspector
  16. EditorUtility.FocusProjectWindow();
  17. EditorGUIUtility.PingObject(textSettings);
  18. }
  19. else
  20. TMPro_EventManager.RESOURCE_LOAD_EVENT.Add(ON_RESOURCES_LOADED);
  21. }
  22. // Event received when TMP resources have been loaded.
  23. static void ON_RESOURCES_LOADED()
  24. {
  25. TMPro_EventManager.RESOURCE_LOAD_EVENT.Remove(ON_RESOURCES_LOADED);
  26. TMP_Settings textSettings = TMP_Settings.instance;
  27. Selection.activeObject = textSettings;
  28. // TODO: Do we want to ping the Project Text Settings asset in the Project Inspector
  29. EditorUtility.FocusProjectWindow();
  30. EditorGUIUtility.PingObject(textSettings);
  31. }
  32. }
  33. }
  34. #endif