Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

UIElements: engine or ui?

Discussion in 'UIElements' started by ReadyPlayGames, Dec 26, 2018.

  1. ReadyPlayGames

    ReadyPlayGames

    Joined:
    Jan 24, 2015
    Posts:
    45
    Going through the UIElements Developer's Guide, I have noticed some differences between the github examples and those listed in the "guide". Such as...

    Examples:
    <UXML xmlns:ui="UnityEngine.Experimental.UIElements">
    <ui:Label text="This container has no tooltip but its children do"/>

    Guide:
    <engine:UXML xmlns:engine="UnityEngine.Experimental.UIElements">
    <engine:Label text="Select something to remove from your suitcase:"/>

    Which should we use? "engine" or "ui"? Are they different somehow?
     
    Last edited: Dec 26, 2018
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    102
    No they represent the same thing, which is a prefix for a namespace in the document.
    You can read about this here: https://en.wikipedia.org/wiki/XML_namespace

    A good approach is to also assign a default namespace:

    Code (CSharp):
    1.  
    2. <UXML xmlns="UnityEngine.Experimental.UIElements">
    3.     <Label text="This container has no tooltip but its children do"/>
    4. </UXML>
    5.  
    This makes it unnecessary to use a prefix for builtin elements. Our examples should be upgraded to that.
     
    satchell and AndrewKaninchen like this.
  3. ReadyPlayGames

    ReadyPlayGames

    Joined:
    Jan 24, 2015
    Posts:
    45
    Ah, thank you. I'm going to change code to that as well. Unless I can submit changes to your examples? It's always nice to help out!
     
  4. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    289
    We don't have a process in place yet to accept changes. But thank you! We are working on better examples which will have more consistent UXML namespaces.