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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

UI Builder available in Package Manager

Discussion in 'UI Toolkit' started by Kamyker, Sep 24, 2019.

  1. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
    https://docs.unity3d.com/Packages/com.unity.ui.builder@latest/index.html


    Little sad that none of the Unite talks are streamed, hope to see them being uploaded later.

    "UI Builder: Cannot load .uxml files outside the Project." - I wish I could open those in (editable) Packages. Nvm I see it is working but I have to load them in Library window instead of File button
     
    Last edited: Sep 24, 2019
  2. Curlyone

    Curlyone

    Joined:
    Mar 15, 2018
    Posts:
    41
    Hello, so i got this package for beta version thinking i could create in-game UI using UIElements, but i am lost here since i couldnt see any way to place the created tree into the game, so is this only for creating/editing UIElements visually or is there actually a way to create in-game UI ?

    PS: I am not experienced with UIElements, i know its for editor only for the time being and it will be released for in-game UI as well, but this package kind of give me hope haha :D
     
  3. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    416
    You pretty much answered your own question. There's no way to put UI into the game yet but it will hopefully come soon.
     
    Curlyone likes this.
  4. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,658
    Last edited: Oct 1, 2019
  5. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    Just to confirm, the UI Builder package is just for the visual authoring tool itself. It does not add runtime support for UIElements. It lets you create UXML and USS assets which will be usable both in the Editor and at runtime (once we have support for that). We'll post more info on this tool shortly.

    For runtime support, there exists a different package which we will talk about more once Unity 2019.3 comes out.
     
    sandeepsmartest likes this.
  6. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    416
    When the runtime support arrives, will it have new runtime controls for us to use, and will we be able to use some of the current controls, like tree views, at runtime? Some of the current controls feel borderline unusable for runtime.
     
  7. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    In time, yes. Runtime support will arrive first as a preview package, with the focus being to just _run_ UIElements in the Game view. A lot more work will follow to adjust, modify, and fix some of our controls to work better at runtime. But, one step at a time.
     
    Hertzole likes this.
  8. Haapavuo

    Haapavuo

    Joined:
    Sep 19, 2015
    Posts:
    95
    Hey. This looks very promising. A few questions though:

    1. How can I set the UI Elements to follow a 3D object in game (like a tooltip over a 3D character)?
    2. How can I insert a 3D object into the UI?
     
  9. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    1. Once the runtime package is public you'll just need to project your 3D object transform to the camera screen space and use that to drive the absolute position of an element. We have plans to have more built-in support for this use case but until then, it should be possible to do on your own.
    2. 3D objects in the UI is something we're still working so you won't be able to do that in the initial release of the runtime package. However, the UIElements API is flexible enough to probably make it work in some specific cases.
     
    wbahnassi_unity likes this.
  10. ShellsC

    ShellsC

    Joined:
    Jun 14, 2019
    Posts:
    1
    Is there a way of connecting the layout of the UXML and USS files to actual functions like clicking on a button and it opens another window or panel? I was able to code button functions using C# in the project window.
    I made three test windows to make a working UI, but I need a way of switching to them and I have not worked with UXML or USS (or even XML and CSS).

    Do I have to reference the UXML files in a C# script or is there a different way I can code this?
     
  11. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    138
    Hey you guys have done a great job!!Well im confused with the phrase " It does not add runtime support for UIElements" .What exactly this means.I have few questions
    1. Can we add buttons , change sprites , instantiate buttons/sprites during runtime??
    2. How can we run Animations using timeline (animators)
    3. Like multiple canvases, how can we do this with new UI builder
    4. How about performance? If we use canvases and if any object(sprite/buttons etc) gets enabled/disabled/moved etc, existing UI system would redraw the entire canvas and its a costly process.What happens with this new ui builder?
    5. How nicely would this layout change(any new features for handling this? i know about anchoring) with all mobile resolutions especially full screen/super wide resolutions eg: 20:9 etc??
     
    Tony_Max likes this.
  12. SergiRegi

    SergiRegi

    Joined:
    Apr 11, 2016
    Posts:
    10
    Hi
    My question is.
    How can I add and / remove a child .uxml file inside a visualelement component placed in other .uxml in runtime in c#? if it can be done.
    Thanks.
     
    Last edited: Jan 4, 2020
  13. jonathanma_unity

    jonathanma_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    229
    Hi,

    UXML file cannot be added directly to a VisualElement, they need to be instantiated which will return a VisualElement tree as defined in the UXML.

    In your case you may want to add/remove the top element of the UXML tree.
     
  14. Develax

    Develax

    Joined:
    Nov 14, 2017
    Posts:
    67
    I can't find a PanelRenderer component demonstrated in the video presentation. Where is it?
     
  15. MiguelOscarGarcia

    MiguelOscarGarcia

    Joined:
    Oct 19, 2019
    Posts:
    8
    You have to copy & paste the whole Assets/UIERuntime folder from https://github.com/Unity-Technologies/UIElementsUniteCPH2019RuntimeDemo to your Assets folder. Then you should have Unity.UIElements.Runtime.PanelRenderer class available in your scripts. And a GameObject > UIElements > Panel in your Editor.
     
    Last edited: Jan 15, 2020
    CyrilGhys likes this.
  16. ericmaicon

    ericmaicon

    Joined:
    Sep 28, 2015
    Posts:
    1
    This one didn't work for me:
    Code (CSharp):
    1. Assets/UIERuntime/Editor/InternalBridge/EditorInternalBridge.cs(20,13): error CS0103: The name 'UIElementsEditorRuntimeUtility' does not exist in the current context
    2.  
     
  17. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    I am not recommending this "copying of UIERuntime to own project" approach, but...if you must, you must do it in a newer version of Unity 2019.3. This will not work on 2019.2.
     
  18. AdamRamberg

    AdamRamberg

    Joined:
    Dec 8, 2016
    Posts:
    22
    This is truly great! Got one question for you. Is there a way of defining where in the UXML templates children will end up? By children I mean the place where sub trees will end up when the UXML template has been instantiated and you call Add on that VisualElememt. See for example how children works in ReactJS.
     
  19. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    386
    When defining a template, you can add the content-container="true" attribute to the visual element that will be the default parent for children of the template instantiation.

    For this to properly work, you must use VisualTreeAsset.Instantiate() when creating your VisualElements from the uxml asset. Then any call to .Add() will add to this child.
     
  20. AdamRamberg

    AdamRamberg

    Joined:
    Dec 8, 2016
    Posts:
    22
    Awesome! Thanks a bunch!
     
  21. nightborn

    nightborn

    Joined:
    Jan 2, 2018
    Posts:
    4
    Could we help into the development of this package in some way? Is there's some repository with the code or it is completely private?
     
  22. AdamRamberg

    AdamRamberg

    Joined:
    Dec 8, 2016
    Posts:
    22
    @nightborn I would also be interested in contributing if possible!
     
  23. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    It is currently private, though you do have full source access through the package system. The code is still in flux and some refactors are planned so we didn't want to also have to worry about breaking people's forks or branches.

    Anything specific you would like to work on?
     
  24. igoraleftinovich

    igoraleftinovich

    Joined:
    Feb 11, 2017
    Posts:
    17
    Hi! First of all want to thanks developers for such amazing tool! I was waiting for something like this for years))

    I have a question - how can I change ObjectField.Label's minWidth value? May be there is the way to copy build in style and change it or something else?
    2020-03-02_13-18-50.png

    Thanks!
     
    Anisoft likes this.
  25. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    195
  26. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    195
    looks like this is only happening in 2020...no hanging in 2019.3
     
  27. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    Please start a separate thread for issues and questions like this so we can stay on subject. But this looks like a bug. If you can get it to reproduce with the latest 2020.1 beta and latest UI Builder package version (currently 0.10.2-preview), and even in an empty project, please report it as a bug using the Bug Reporter in the Help menu.
     
  28. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    Please start a separate thread for issues and questions like this so we can stay on subject. For this, see another thread that asked the same thing here:
    https://forum.unity.com/threads/uielements-text-field-changing-child-elements.789656/
     
    toomasio likes this.
  29. FanStudioUK

    FanStudioUK

    Joined:
    Mar 31, 2013
    Posts:
    22
    Hi @uDamian,

    I just wanted to ask you if you have any updates on the UI Builder official release. I know it's planned to be released this summer.

    We are currently starting working on a pretty complex project with Unity 2019.3 and we want to make sure we will be able to use UI Builder as we really like working with it so far.

    Can you confirm that it will be fully supported with version 2019.3 or any 2019 upcoming versions?

    Thank you!
     
  30. CyrilGhys

    CyrilGhys

    Joined:
    Nov 1, 2018
    Posts:
    29
    Hello, so what are you recommending in case the Panel Renderer doesn't show up ?
    It seems like my UI Builder is up to date (0.10.2) and I don't see anything when I want to Add Component.

    Thank you !
     
  31. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,655
    Afaik Panel Renderer is part of Runtime folder from sample project of last Unite (cph), it’s not officially released even for preview. UI Builder is just convenient tool for building you USS/UXML.
     
    CyrilGhys likes this.
  32. MitoG

    MitoG

    Joined:
    Sep 17, 2015
    Posts:
    1
    So at the moment you can just build a UI but are not able to use it in any project ?

    Apart from when you include the runtime folder of the sample project on github ?
     
  33. sregnault

    sregnault

    Joined:
    Jan 15, 2018
    Posts:
    6
    Hi, is it normal I don't have acees to all components in UI Builder since I change my Unity version to Unity 2020.1b.16 ?
     
  34. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    Please start a new thread next time. This is an ancient thread that has little to do with your question.

    But to briefly answer, from the UI Builder 1.0.0-preview.1 CHANGELOG:
    And as of UI Builder 1.0.0-preview.2:
     
    CyrilGhys and sregnault like this.
  35. sregnault

    sregnault

    Joined:
    Jan 15, 2018
    Posts:
    6
    Sorry, I'll do next time. Thanks for the quick answer !
     
  36. rfpt88

    rfpt88

    Joined:
    Apr 29, 2019
    Posts:
    1
    Quick question, the Builder 1.0.0-preview.3 works in Unity 2019.4.4f1 LTS?
    I used the code from Unite (cph), but i can't see any UI.
     
  37. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    UI Builder should definitely work with 2019.4. The main question is whether the Unite CPH demo still works with 2019.4. Can I confirm you're talking about this?
    https://github.com/Unity-Technologies/UIElementsUniteCPH2019RuntimeDemo
     
  38. SteveJones92

    SteveJones92

    Joined:
    Apr 24, 2018
    Posts:
    1
    Is the UI Builder functional for runtime as of 2019.4.8f1 LTS?
     
  39. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203
    UI Builder is itself functional in 2019.4. But UI Builder is just the authoring tool/package for UI Toolkit. It does not come with any support for runtime UI. There is a separate package for the UI Toolkit framework itself, called com.unity.ui, that adds runtime support for UI Toolkit. But to answer your question, no, runtime support is only for 2020.1 and newer (because this com.unity.ui does not work on 2019.4).
     
  40. brunordeangelis

    brunordeangelis

    Joined:
    Jul 30, 2020
    Posts:
    4
    Hi, this is awesome, however I'm not fully understanding how to get it into my project. I only have "Unity UI" visible in my package manager, but I reckon that has nothing to do with the UI Builder.

    Is this production ready? We're building a 2D MMO and I was hoping to use a similar syntax to web development for building the UI.

    Thank you very much!
     
  41. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,203