summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_ProjectTextSettings.cs
blob: 8a3258b4937028cc27d223ab7310f7535849b1ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#if !UNITY_2018_3_OR_NEWER
using UnityEditor;

namespace TMPro
{

    public static class TMP_ProjectTextSettings
    {
        // Open Project Text Settings
        [MenuItem("Edit/Project Settings/TextMeshPro Settings", false, 309)]
        public static void SelectProjectTextSettings()
        {
            TMP_Settings textSettings = TMP_Settings.instance;

            if (textSettings)
            {
                Selection.activeObject = textSettings;

                // TODO: Do we want to ping the Project Text Settings asset in the Project Inspector
                EditorUtility.FocusProjectWindow();
                EditorGUIUtility.PingObject(textSettings);
            }
            else
                TMPro_EventManager.RESOURCE_LOAD_EVENT.Add(ON_RESOURCES_LOADED);
        }


        // Event received when TMP resources have been loaded.
        static void ON_RESOURCES_LOADED()
        {
            TMPro_EventManager.RESOURCE_LOAD_EVENT.Remove(ON_RESOURCES_LOADED);

            TMP_Settings textSettings = TMP_Settings.instance;

            Selection.activeObject = textSettings;

            // TODO: Do we want to ping the Project Text Settings asset in the Project Inspector
            EditorUtility.FocusProjectWindow();
            EditorGUIUtility.PingObject(textSettings);
        }
    }
}
#endif