Wrapping Buttons for "Level Select" Screen


For my game, I am creating a level select screen. After switching to Unity 5, I have decided to use the new UI features for the project.

The problem I am running into is that when I resize my screen, it is nearly impossible to find the right combinations of anchors and positions to make it look nice. Here’s a rough idea of what I am trying to accomplish:

alt text

When I resize my screen, I can make the buttons either stretch, spread out, or stay in place. Is there a way to make the buttons “wrap” so that if I were to stretch out the screen, it would look like this?

alt text

Would it make more sense to not use the new UI features and just stick to the basic GUI class? Or is there a way to do this that I don’t understand?

Thanks a ton.

  • Josh

Looks like you’re using a Grid Layout component, right? For cases like this, that won’t work very well without some tweaking. If you’re really still interested in using that component, I could help you work out a solution - but my personal recommendation would be to create a finite amount of buttons and anchor them to the center of the screen so that they don’t move around on you like that.

As I said, Grid Layout components work great for certain circumstances, but this is one where it will fight you. :slight_smile:

Good luck!