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

Grid/Float containers

Discussion in 'UGUI & TextMesh Pro' started by Frooxius, Aug 21, 2014.

  1. Frooxius

    Frooxius

    Joined:
    Aug 15, 2012
    Posts:
    57
    Hello!

    EDIT: Sorry, nevermind, I missed that there's Layout group in the components outside of the UI group. Maybe it could be under the UI as the Effects are?

    I love the addition of the new UI system in Unity 4.6, it will make a lot of things much simpler. But there are some things that I'm missing, so I'd like to ask if you're planning on adding these so we don't have to implement them ourselves.

    One essential thing are grid/float containers for nested elements, which will automatically arrange the children UI elements. For example I might want to throw dozens of elements into some container and have them fill the rows/columns based on the current width/height of the container, so the container can be resized at runtime and the nested elements will be repositioned appropriately.
     
    Last edited: Aug 21, 2014
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    A GridLayoutGroup is already included with the UI system. See the documentation for details and the layout groups scene in the example project.

    We don't have something like a float container - I'm not sure exactly what behavior you mean here; whether it's like float elements in HTML or something else. We don't have any plans to implement it at this point.
     
  3. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    I assume he means something like this:
    http://docs.oracle.com/javafx/2/layout/builtin_layouts.htm#CHDGHCDG
    FlowPane
    The nodes within a FlowPane layout pane are laid out consecutively and wrap at the boundary set for the pane. Nodes can flow vertically (in columns) or horizontally (in rows). A vertical flow pane wraps at the height boundary for the pane. A horizontal flow pane wraps at the width boundary for the pane. Figure 1-10 shows a sample horizontal flow pane using numbered icons. By contrast, in a vertical flow pane, column one would contain pages one through four and column two would contain pages five through eight.

    Figure 1-10 Sample Horizontal Flow Pane
     
  4. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    If all the elements are the same size then this looks to be the same functionality already provided by the GridLayoutGroup.
     
  5. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Well, bad example :) They can be any size and go to next row/column when bounds of container is reached.

     
  6. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    All right. The UI system doesn't come with such a layout group type out of the box, though it would be possible to create one with scripting by implementing the ILayoutGroupController interface and controlling the positions and sizes of the children in the appropriate way.