Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to draw a multi colomn table using UIElements

Discussion in 'UI Toolkit' started by NotGoodEnoughh, Sep 6, 2019.

  1. NotGoodEnoughh

    NotGoodEnoughh

    Joined:
    Feb 1, 2018
    Posts:
    35
    Hello! Can you say me how can I draw a table using UIElements?
    I saw a TreeView in UXML ref, but I can't find any helpful examples of its usage.
     
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    492
    Hello!
    You'll have to be more precise on what you want to achieve. There's the ListView component that could be a good fit for your needs.

    You can take a look at [Window > UI > UIElements Samples] for examples.
     
    Last edited: Sep 6, 2019
    YuriyPopov likes this.
  3. NotGoodEnoughh

    NotGoodEnoughh

    Joined:
    Feb 1, 2018
    Posts:
    35
    Thanks for reply! ListView isn't my variant.
    I need something like on the photo(without the treeview below the Name column)
    upload_2019-9-6_19-26-8.png
     
  4. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    492
    Hey! UIElements doesn't have a grid layout system yet. However, you could achieve the same result as your photo using a scrollView and a mixte of flex-direction column and row.

    Here's the doc for the layout engine: https://docs.unity3d.com/Manual/UIE-LayoutEngine.html
     
  5. StefanWo

    StefanWo

    Joined:
    May 24, 2015
    Posts:
    121
    Is there any update on a grid layout system?

    I need the same thing. But i can't find a solution when you have more than 1 dynamic width.
    I can just do it with flex-direction col and row layout, and set the dynamic col to grow:1 and the rest has to have width and max-width set to a fix value, or is there another way?
     
    mowax74 likes this.
  6. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    567
    hawaiian_lasagne and StefanWo like this.