public override void OnEnable()
    {
        base.OnEnable();

        // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
        string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

        // Initialized instance of Material Editor State Manager
        if (EditorGUIUtility.isProSkin)
        {
            mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
        }
        else
        {
            mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
        }

        if (mySkin != null)
        {
            Group_Label      = mySkin.FindStyle("Group Label");
            Group_Label_Left = mySkin.FindStyle("Group Label - Left Half");
        }



        // Initialize the Event Listener for Undo Events.
        Undo.undoRedoPerformed        += OnUndoRedo;
        Undo.postprocessModifications += OnUndoRedoEvent;
    }
Beispiel #2
0
    public override void OnEnable()
    {
        base.OnEnable();

        //Debug.Log("New Instance of SDF Material Editor with ID " + this.GetInstanceID());

        // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
        string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

        // Initialized instance of Material Editor State Manager
        if (EditorGUIUtility.isProSkin)
        {
            mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
        }
        else
        {
            mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
        }

        if (mySkin != null)
        {
            Group_Label      = mySkin.FindStyle("Group Label");
            Group_Label_Left = mySkin.FindStyle("Group Label - Left Half");
        }


        // Get a reference to the TextMeshPro or TextMeshProUGUI object if possible
        //if (Selection.activeGameObject != null)
        //{
        //    if (Selection.activeGameObject.GetComponent<TextMeshPro>() != null)
        //    {
        //        m_textMeshPro = Selection.activeGameObject.GetComponent<TextMeshPro>();
        //    }
        //    else
        //    {
        //        m_textMeshProUGUI = Selection.activeGameObject.GetComponent<TextMeshProUGUI>();
        //    }
        //}


        // Initialize the Event Listener for Undo Events.
        Undo.undoRedoPerformed += OnUndoRedo;
        //Undo.postprocessModifications += OnUndoRedoEvent;
    }