Search Unity

Regarding runtime UI elements and referencing it

Discussion in 'UIElements' started by RealMTG, Sep 4, 2019.

  1. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    271
    Hello!

    I'm just very curious about the new runtime UI elements and how it will work with "applying" the UXML and USS. Like, right now, when you want to load a file you have to use AssetDatabase or something like Resources.Load, which in my opinion, is horrible. Hardcoded paths should not be mandatory. So at runtime, can we reference these UXML and USS files on a component of some sort to load them instead of using coded paths?
    To me, this is quite the dealbreaker. Without a way to directly reference these files, this feature will be useless to me when it comes to assets because I want to my third party assets into a "Imported" folder.

    Thanks, and I'm really looking forward to the new system! :)
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    489
    Just to give you an idea of the approach we're taking, there will be a Panel Component you add to a GameObject that will have parameters to assign a uxml asset and 0 or more uss assets. This link would therefore be done in the scene and work at runtime without hard-coded paths.

    This Panel Component would have a root VisualElement, just like EditorWindow does now, where it will clone the uxml and to which you have full access to the entire UI hierarchy.
     
    eidetic, Kirsche and RealMTG like this.
  3. eidetic

    eidetic

    Joined:
    Jun 27, 2016
    Posts:
    13
    That sounds great @uDamian!
    Will the VisualElements inside this Panel Component be transformable in 3D?
     
    Last edited: Oct 10, 2019
  4. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    489
    Not initially but eventually, yes. You already do have access to any element's 3D transform, however, all UI is rendered in orthographic screen space right now. Once we add screen overlay and world space UI support, the existing 3D transform access will be a lot more useful.
     
    eidetic likes this.
  5. softone

    softone

    Joined:
    Oct 25, 2013
    Posts:
    8
    Hi. Now that 2019.3 is out of beta, is this Panel Component available?
     
  6. RealMTG

    RealMTG

    Joined:
    Jul 27, 2013
    Posts:
    271
unityunity