Search Unity

Unity UI redone in UIElements?

Discussion in 'UI Toolkit' started by col000r, Feb 2, 2020.

  1. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    662
    Just out of interest: Is the entire UI of Unity being redone with UIElements? How's it going?
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    612
    This will be a slow process and it's not our focus right now. Runtime will be the main focus, as well as new Editor UI. But..."eventually".

    That said, even if it was redone, it should look and feel the same. Any specific reason your asking?
     
  3. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    662
    Thanks for the info!
    I'm asking because I've been working on a course about Editor Customization for quite a while and am trying to gauge how relevant IMGUI will stay for Unity in the future. Basically just checking that no one is getting any crazy ideas about deprecating it... :)
    Having now built a few things with UIElements I have to say that I appreciate how much easier it is to build complex things with it, but I find IMGUI is still a great option for building simple things, just because it's so quick and easy to get something going! If you're just building a simple tool for one job that no one else is ever going to see, then the only thing you care about is functionality and then Immediate Mode is the most efficient way to get that done.
     
  4. sebastiend-unity

    sebastiend-unity

    Unity Technologies

    Joined:
    Nov 9, 2015
    Posts:
    32
    Hi col000r,

    Depending on your course examples, you can still build UI quickly with UIElements. It will not be a 4-3 lines of code-type of thing like some IMGUI examples but you can reuse a lot. So your examples can build off each other.

    As for IMGUI deprecation, I think it's safe to say the tech will be there for a while still (read: a few major versions). We do however encourage devs to use UIElements by default now. As mentioned previously, we are aware that a few controls and features are still missing and we are progressing towards full parity. We are aiming for parity with UGUI at the same time, adding to the length of the task.

    Sebastien
     
  5. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    238
    I for one am really excited for this to happen.

    I often want to extend unity's (inspector editors), and I either have to re-create the editor myself or do a big fat hack using
    GUI.SetNextControlName
    , which only works if the I want to check for the element.

    This is the code I use to check if a user edited the text field in a text mesh pro element (and clicked off)
    Code (CSharp):
    1.  
    2.     public override void OnInspectorGUI()
    3.     {
    4.         switch (Event.current.type)
    5.         {
    6.             case EventType.KeyDown://If it was typed
    7.             case EventType.MouseDown://If it was copy/pasted
    8.             case EventType.Repaint:
    9.                 GUI.SetNextControlName("Text");
    10.                 bool wasSelected = HasSelected;
    11.                 HasSelected = string.Equals(GUI.GetNameOfFocusedControl(), "Text");
    12.                 if (HasSelected && !wasSelected)
    13.                 {
    14.                     CachedValue = m_TextProp.stringValue;
    15.                 }
    16.                 break;
    17.         }
    18.      
    19.  
    20.         EditorGUI.BeginChangeCheck();
    21.         base.OnInspectorGUI();
    22.  
    23.         if (EditorGUI.EndChangeCheck() && HasSelected)
    24.         {
    25.             HasEdited = true;
    26.         }
    27.         else
    28.         if (HasEdited && (!HasSelected || !EditorGUIUtility.editingTextField))
    29.         {
    30.             if (!EditorGUIUtility.editingTextField)
    31.             {
    32.                 GUI.FocusControl(null);
    33.             }
    34.             if (!string.Equals(m_TextProp.stringValue, CachedValue))
    35.             {
    36.                 CachedValue = m_TextProp.stringValue;
    37.                 /////////////////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    38.                Debug.Log("The user changed the text);
    39.  
    40.            }
    41.            HasEdited = false;
    42.        }
    43.    }
    imagine how simple it would be if I could register callbacks for fields, like you can in UIElements
     
  6. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    353
    Can you share a similar estimate for runtime UGUI?
     
  7. sebastiend-unity

    sebastiend-unity

    Unity Technologies

    Joined:
    Nov 9, 2015
    Posts:
    32
    Parity w/ UGUI does not mean every feature of UGUI will have its UIE Runtime counterpart (e.g. layout feature in UGUI does not have the same specs as UIE-RT but similar results can be achieved via USS flex, display and other Yoga style properties).

    With that said, we are hoping for UIE Runtime support at end of year.
     
    Le_Tai likes this.
unityunity