Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

UIElements Samples Window (2019.2)

Discussion in 'UI Toolkit' started by uDamian, Mar 6, 2019.

  1. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    If you have a chance to try 2019.2 and are using UIElements, have a look at the UIElements Samples Window built right into the Editor. You can access it via:

    Window > UI > UIElements Samples

    It contains C#, UXML, and USS example code snippets for most of the core elements that come with Unity, with each sample running live in-window. Screenshot below.

    Curious to know what you think.

    UIElementsSamplesWindow.jpg
     
    Last edited: Mar 6, 2019
    Xarbrough, Ofx360, Lahcene and 6 others like this.
  2. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    Something is wrong with the slider. When we try to use the upper slider, the lower one is used.
     
  3. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    That's exactly how the Slider example should work. :)

    Most of the controls have 2 samples, one that is readonly and another that isn't. If you look at the code, you'll see that the two samples are usually linked (where one drives the other).
     
    JoNax97 likes this.
  4. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    Yes, but the element itself can be controlled.
    63c6b13d-24e1-40da-a000-f968269df3c8.gif
    scroller* sry
     
  5. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    Ah, I thought this was fixed. Looks like it wasn't. Can you submit a bug please?
     
  6. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    325
    Hi UI team,

    In Style section, can you add multiple editing look ?
    And can we add our samples in this windows ?

    Thanks for your great work !
     
  7. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    I'm not sure what you mean by "multiple editing look". As for adding your own samples to this window, it's definitely a neat idea. I'll add it to our backlog. :)
     
  8. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    325
    I mean UI look when we have 'SerializedProperty.hasMultipleDifferentValues to true.'
     
  9. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    Ah, I understand. We still need to add support for multi-value support on UIElements fields, but once we do, the samples window should have an example.
     
    Sylmerria likes this.
  10. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    685
    Hey, that's awesome, thanks @uDamian ! Is the source for the example window available somwhere? (I'm trying to create a tree-view like the list on the left side...)
     
  11. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    For now, the TreeView control that the Samples Window uses is not public. Once it becomes public, we'll have an example of its usage in the Samples Window.
     
  12. Lahcene

    Lahcene

    Joined:
    Jun 18, 2013
    Posts:
    26
    Great work, this is really helpful, I can never get enough of UIElement examples.
    But wouldn't it make more sense to have this available as a Package?
    Having a built-in windows for Samples seems a bit odd.
     
  13. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    UIElements is in core Unity (because it drives all Editor Windows). The samples are generated from the core API and bundled as resources with the Editor so they are always in sync with the API. Additionally, it's easier to say:
    Go to main menu -> Windows -> UI -> UIElements Samples
    instead of introducing packages, and worrying about which version of the samples window you're looking at. We'll see about moving to a package later.
     
    Lahcene likes this.
  14. Lahcene

    Lahcene

    Joined:
    Jun 18, 2013
    Posts:
    26
    It makes sense then, yes.
     
  15. Leslie-Young

    Leslie-Young

    Joined:
    Dec 24, 2008
    Posts:
    1,109
    Ooh, this will be useful. Thanks!
    Downloading 2019.2 now!
     
  16. Lednar

    Lednar

    Joined:
    Jan 9, 2018
    Posts:
    13
    I opened UIElements Samples window and I could see only left panel. The whole window was so narrow that I did not understand what help could I get it from it. I had to drag it wider. Never opened UIElements Samples window before so I have not resized it myself. Is it possible to make sure that if you open it at least first time, you see left and also right panel?
    Otherwise this is very useful window, because examples are always big help for me to get started.
     
    tik_tikkers likes this.
  17. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,065
    It's come up before as an issue and we're tracking it. Thanks for the reminder though! Should be fixed soon hopefully.
     
  18. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    210
    Bump, this took a lot of my time as well - and worse, took time from Unity Devs, as I was asking questions I did not have to, did not understand what the window was, no indication it could be resized to show the actual info..
     
unityunity