Search code examples
unity-game-engineunity3d-gui

How to line-break buttons using Unity 3D New UI


I'm not familiar with Unity's new UI system of 4.6 and later. I would like to display a series of buttons on screen and have them center-aligned and breaks into the next line when screen width is reached. The old OnGUI function no longer seem working so I wonder how can I achieve this?


Solution

  • You need to use UI's layout system. Usually, you just create a Layout Group and populate it with objects that have Layout Element component.