Search Unity

Missing Layout controls

Discussion in 'UIElements' started by chrisk, Mar 21, 2019.

  1. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    478
    Hi, I just looked that the UIElement, the first Control I was looking for a Panel and a Grid Controls. They are essential controls to make a sophisticated Editor. I'm sure you guys are working on it and I was wondering about ETA.

    Thanks.
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    101
    Hello,

    I am not exactly sure about a "Panel" control refers to. If you could give an example maybe we could redirect you to something similar.

    Regarding a Grid Control, the layout system is quite flexible in that it natively support wrapping around to give a grid effect. For example see the following UXML/USS files:

    grid.uxml

    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <UXML xmlns="UnityEngine.UIElements">
    3.     <VisualElement name="root">
    4.         <Style path="Assets/Editor/grid.uss" />
    5.         <VisualElement/>
    6.         <VisualElement/>
    7.         <VisualElement/>
    8.         <VisualElement/>
    9.         <VisualElement/>
    10.         <VisualElement/>
    11.         <VisualElement/>
    12.         <VisualElement/>
    13.         <VisualElement/>
    14.         <VisualElement/>
    15.         <VisualElement/>
    16.     </VisualElement>
    17. </UXML>
    grid.uss

    Code (CSharp):
    1. #root {
    2.     flex-direction: row;
    3.     flex-wrap: wrap;
    4. }
    5. #root * {
    6.     background-color: #F00;
    7.     width: 100px; height: 100px;
    8.     margin-bottom:10px;
    9.     margin-right: 10px;
    10. }
     
  3. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    478
  4. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    56
  5. benoitd_unity

    benoitd_unity

    Unity Technologies

    Joined:
    Jan 2, 2018
    Posts:
    97
    vincismurf likes this.
  6. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    182
    I think a Grid is essential. . . . AKA the HTML Table . . . it would make organizing editor content more intuitive.
     
    benoitd_unity likes this.
  7. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    157
    A constraint solver using the cassowary algorithm would be really nice. Apple uses it for its Auto Layout system.