Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

extend current inspector for UI components

Discussion in 'UGUI & TextMesh Pro' started by Breyer, Aug 22, 2014.

  1. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    i figure for myself that i create css like system with scriptableObject for exist text component but i need to extend current inspector. For that i wrote

    Code (CSharp):
    1. using UnityEditor;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4. using UnityEngine.Events;
    5. using System;
    6. using UnityEngine;
    7.  
    8. [Serializable]
    9. public class CSSContainer
    10. {
    11.         [SerializeField]
    12.         private string
    13.                 name;
    14.         //public CSS4UGUI css; /scriptableObject?
    15. }
    16. [CustomEditor(typeof(Text))]
    17. public class TextClassHandler : UnityEditor.UI.TextEditor
    18. {
    19.         /*public string Text {
    20.                 set {
    21.                         OnValueChanged.Invoke ();
    22.                         textComponent.text = value;
    23.                 }
    24.         }*/
    25.         public CSSContainer[] cssList;
    26.         public UnityEvent OnValueChanged;
    27.         // Use this for initialization
    28.         void Start ()
    29.         {
    30.                 //new TextEditor()
    31.         }
    32.    
    33.         public override void OnInspectorGUI ()
    34.         {
    35.                 Debug.Log ("ba");
    36.                 //base.OnInspectorGUI ();
    37.         }
    38. }
    39.  
    and no log in console

    what i forgot? it is impossible because custom editor exist already? and i must create completely new component for workaround?
     
    seaders likes this.
  2. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Can someone say me that, in general, extending current UI component is possible or not without touching sources? or i must create new component which derive from UI component then create custom editor like above?
     
  3. seaders

    seaders

    Joined:
    Oct 28, 2014
    Posts:
    29
    I'm in the exact same boat and I'm getting no help either. Nobody's even saying it's not possible, just the same as this, get nothing back. Not sure where to turn to as a Unity beginner :(
     
  4. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    This is nonactual for me - this is impossible without creating dummy script which derive from specific class