Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Official UIElements for Runtime and the UI Builder Unite Copenhagen 2019 Talk

Discussion in 'UI Toolkit' started by uDamian, Oct 10, 2019.

  1. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,049
    Have seen that package manager have new feature, we could specify path into git repo for package now. Playing with it is funnily success

    "com.unity.ui.runtime": "https://github.com/Unity-Technologies/UIElementsUniteCPH2019RuntimeDemo.git?path=/Assets/UIERuntime/",


    upload_2020-2-11_2-40-57.png
     
  2. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    561
    I can't see any support for world space positioning in the runtime examples. What's the plan for this? (specifically for VR in my case)
     
    Pixionrevolution likes this.
  3. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    There is no world space support in the current preview of our runtime support. It's slated to be supported in the full release of the UIElements package at the end of 2020 but it might slip as we focus on making screen space fully functional. For now, we don't recommend UIElements if you plan to make a VR app with world space UI in 2020.
     
    Thaina likes this.
  4. spaceemotion

    spaceemotion

    Joined:
    Sep 29, 2015
    Posts:
    95
    Would the screenspace solution near end of 2020 support 3d models in the UI (e.g. for showing stuff in inventory)? Right now we're using a canvas linked to a camera.
     
  5. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    What is the state of Runtime support for Unity 2020.a1?
     
  6. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    We are still working on moving UIElements to a package. The package will work with 2020.1 and will include runtime support, but initially, it will be at a similar level it was when we previewed it for 2019.3 as part of the Unite demo. Improvements will come later in the year along with the full release of 2020.1.
     
    TJHeuvel-net likes this.
  7. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    What is the state with current 2020.1a
     
  8. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    318
    @Digika well like the version number implies it's still in alpha. Previous tech releases were timed similarly or almost on the same day as several package releases. So my expectation would be that by the time 2020.1.0 releases, we'd see the UI elements pacakge with runtime support. So a couple of months.
     
    uDamian likes this.
  9. TieSKey

    TieSKey

    Joined:
    Apr 14, 2011
    Posts:
    219
    Am I missing something or keyboard events are not implemented in this runtime demo???
     
  10. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    We don't have something like automatic keyboard navigation, if that's what you're looking for, but keyboard events should work (if mouse events work for you). You have to register for and listen for keyboard events (just like mouse events) on your focused elements.
     
  11. TieSKey

    TieSKey

    Joined:
    Apr 14, 2011
    Posts:
    219
    Thx for the answer.

    Well, I can't make them work. Mouse events work just fine but keydown/up events are not being fired.

    This is a fragment of the code I'm messing with:
    Code (CSharp):
    1. Button b = c.Q<Button>("skill-button");
    2.         b.RegisterCallback(delegate(MouseEnterEvent ev, Label label) { label.style.display = DisplayStyle.Flex; }, l);
    3.         b.RegisterCallback(delegate(MouseLeaveEvent ev, Label label) { label.style.display = DisplayStyle.None; }, l);
    4.  
    5.         b.RegisterCallback(delegate(KeyDownEvent ev, Label label) {
    6.             Debug.Log("KeyDown!");
    7.             if (ev.keyCode == KeyCode.Keypad1) label.style.display = DisplayStyle.Flex;
    8.         }, l, TrickleDown.TrickleDown);
    9.         b.RegisterCallback(delegate(KeyUpEvent ev, Label label) {
    10.             Debug.Log("KeyUp!");
    11.             if (ev.keyCode == KeyCode.Keypad1) label.style.display = DisplayStyle.None;
    12.         }, l);
    13.  
    14.  
     
  12. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    If you don't mind, please start a new thread for this topic. It's a bit off and/or too specific for this thread's topic. Thanks!
     
  13. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Okay, what about 2020.1.0b5? Do we have Runtime and Editor support there now?
     
  14. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    They said that the package will be released alongside the final version of 2020.1. We're still a couple weeks from that.
    I'm also dying to try it. :(

    P.S: @uDamian Do you need/want bug reports about runtime at this time? I have found a pair of them and can send them if they're of any use.
     
    Last edited: Apr 10, 2020
  15. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Then how do you plan to report runtime bugs if it does not exist yet? I'm asking if there is the rewritten runtime support in the 2020.1 beta
     
  16. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Version 0.0.4 of the runtime package has been out for several weeks now, is just not officially announced and hidden from the package manager UI. But you can use it today if you add it manually to the manifest.
     
  17. cultureulterior

    cultureulterior

    Joined:
    Mar 15, 2015
    Posts:
    68
    What's the URL to add?
     
  18. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    "com.unity.ui.runtime" : "0.0.4-preview"
     
    cultureulterior likes this.
  19. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Is it worth to even bother with it if they said they rewritten the structure and changed the approach? Learning 0.4.0 seems like waste of time, no?
     
  20. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Well some things pertaining runtime may have changed but the core of UI toolkit is pretty much set in stone by now. I wouldn't say it's waste of time. Most of what you write for UI Toolkit (all of uxml and uss, and most of the logic) works both in editor and in runtime. At most, you will need to change the way panels are created or updated, but i expect it to be a minor change overall.
     
  21. JakHussain

    JakHussain

    Joined:
    Oct 20, 2016
    Posts:
    318
    Yeah it's mainly runtime performance, feature parity with UGUI, support for SRP and eventually (really far down the road) DOTS that's on the roadmap for runtime ui. But the code you write now should largely be unchanged in a years time.
     
  22. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    I see.
    How would I use:
    for runtime?
     
  23. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    You have to manually add
    "com.unity.ui.runtime": "0.0.4-preview"
    to the end of the manifest.json located in the Packages folder of your project. Then open unity and wait while it installs.

    Once installed, add the PanelRenderer component to some gameObject, and give it your uxml and uss to render. To access the panel hierarchy, reference the panel in you script and use the visualTree property.
     
  24. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Thanks. Is there any quick... not tutorials, but rather short guide-examples for the runtime preview?
     
  25. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Yes, if you go to the package manager entry there's 3 sample projects you can import

     
  26. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Thanks, looks like they are a bit outdated for the 2020b1 tho

    Code (CSharp):
    1. 'PanelRenderer' does not contain a definition for 'Start'
     
  27. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    I couldn't tell you, I haven't used them myself. Sorry
     
  28. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Any idea how would I tie the UI elements to the script logic in the latest preview?
     
    Last edited: Apr 22, 2020
  29. JammiK

    JammiK

    Joined:
    Jun 29, 2017
    Posts:
    5
    What about support iOS in latest preview?
    I built app and PanelRenderer does not show anything. May be is it ok? But I didn't find some information about support platforms
     
  30. ZoidbergForPresident

    ZoidbergForPresident

    Joined:
    Dec 15, 2015
    Posts:
    157
    How do we get this? I wanted to fiddle with this (as I'm struggling with UI and think this will make it easier) but the package is not to be found in the manager...
     
  31. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,907
    answer.PNG

    Preview package. Only shows up when you tick that you want to see the preview packages. The place of the check for the preview packages depends on which version of Unity you use. They recently moved this from the package manager to the settings.
     
  32. ZoidbergForPresident

    ZoidbergForPresident

    Joined:
    Dec 15, 2015
    Posts:
    157
    UI Builder? I was looking for UI Elements...

    Also, found somewhere that it was only for editor extensions?

    I'm really quite loss at the information thrown around...
     
  33. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,907
    You didn't really specify. I assumed your "struggle with the UI" refers to the UI Elements. My mistake.
    UIElements is a built-in package.
    answer.PNG

    AFAIK it is production ready for the editor UI and preview for game UI. Meaning you can start to play around with it and with the UI Builder, but it is not 100% yet in game.
     
  34. ZoidbergForPresident

    ZoidbergForPresident

    Joined:
    Dec 15, 2015
    Posts:
    157
    You mean I can fiddle it but games won't work or just that some features are not supported yet?

    Thanks for the info.
     
  35. Ofx360

    Ofx360

    Joined:
    Apr 30, 2013
    Posts:
    155
    UI Builder is what you’d want to build UI for games
     
  36. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    I'll try to add some info here.

    1. UI Toolkit is just a new name for "UIElements", but going forward it will be the name used to refer to both the API and the tools around it.
    2. UI Toolkit contains a C# API (in the UIElements namespace) that is mostly in the UnityEngine namespace (meaning it works at runtime), with some controls in UnityEditor (Editor extensions only).
    3. The UI Toolkit C# API is stable and available in Unity core (no package needed).
    4. The UI Builder is just a tool to let you visually create the UXML text assets (instead of using a code editor). How and where you use those create UXML is up to you.
    5. "com.unity.ui.runtime" package is indeed obsolete now, which is why we never released it or advertised it (as a package). We have transitions the code and continued its development to a new package that will be out in preview soonish. See: https://forum.unity.com/threads/uielements-roadmap-update.784388/
    6. The main things that will change from "com.unity.ui.runtime" is how the PanelRenderer is hooked up to the Scene. So anything you actually build with the C# API, UXML, USS, and the UI Builder will continue to work in the new package we are working on. Only the Scene setup might need some transitioning.

    Hope that answers some questions.
     
    Thaina likes this.
  37. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,195
    This is so absurdly dumb.

    The rename wasn't necessary at all, but by god having the two names around is just going to cause so much confusion. At least consider fixing it? You have an API auto-updater, and this is a pretty trivial auto-update as they go.
     
    marcospgp and riffing like this.
  38. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,049
    I think it possible that there was backward incompability between these 2. It would be easy to just copy whole thing and change name, then change everything it should be changed freely, so it could mutate separately, fixing a bug and update version for the old one before deprecate, and reduce the chance to break people using current UIElements in UnityEngine namespace

    If so then it obvious that rename it into new namespace is easier

    Also it make namespace suggestion autocomplete become less verbose
     
  39. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    It's possible we will address this inconsistency in a future release but we didn't want to break everyone that already uses UIElements APIs (both internally and externally) with these changes. We did consider the auto-updater path but that proved to be much more complex due to the many packages that use UIElements already and to the fact that we also have UXML out in the wild. UXML tag are the same C# types would also need to be fixed.

    If it helps, for now you can think of it like this:
    Code (CSharp):
    1. UI Toolkit ==
    2.     UIElements C# API
    3.     UI Builder authoring tool
    4.     UXML/USS assets and importers
    5.     UI Debugger
    6.     UI Events Debugger
    "UIElements", the name, was often confused between talking about "UI elements on screen", "UIElements the C# API", and "UIElements the framework". This is what we wanted to fix with the new name.
     
  40. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,049
    One thing I would like to request, I wish you would expose everything that underline UXML to be used without any internal class, so we could create and inject our own custom system to generate UIElements token in the equivalence manner as UXML
     
  41. Takage

    Takage

    Joined:
    Nov 13, 2013
    Posts:
    2
    I can t find that package in 2020.1.b in the package manager. How did you manage to get it?
     
  42. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    Did you manually add
    "com.unity.ui.runtime": "0.0.4-preview"
    to the end of your manifest.json ?
     
  43. Takage

    Takage

    Joined:
    Nov 13, 2013
    Posts:
    2
    No I did not. That helps. Thank you
     
    JoNax97 likes this.
  44. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Can someone comment on what is the current status of UI Toolkit ? @uDamian
    • is it available as a package ?
    • is it available for runtime ?
    • Is the UI Builder released ?
     
    TJHeuvel-net likes this.
  45. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    881
    Yes, it's available as a package. To use it at runtime, include this package reference to your manifest.json:

    "com.unity.ui.runtime": "0.0.4-preview"

    The UI Builder is in preview. You can add it via the package manager window after turning on experimental packages for your project.
     
  46. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Thanks. why isn't it available in the UI ? (i mean why do i need to manually update it) ?
    Also - when should it leave the "preview" state? does anyone know ?
     
  47. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    611
    It hasn't even entered the preview state. That's why it's not publicly listed in the package manager. The first official preview is expected to arrive around the time 2020.1 releases (a few weeks from now hopefully). The package is expected to come out of preview around the time 2020 LTS releases (Roughly a year from now)
     
  48. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    881
  49. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    The runtime package broke in 2020.2.0 Alpha 15, hopefully an actual release is coming soon
     
  50. Whitebrim

    Whitebrim

    Joined:
    Jul 11, 2017
    Posts:
    17
    Some info