For context, I am building a portrait-orientation game that is meant to run on mobile devices.
For my current setup, I have a Canvas game object in my scene.
I want to add four buttons:
Left, right, jump, and fire.
These are the requirements that I’m thinking about when laying out these buttons:
- The four buttons should be anchored to the bottom of the canvas (the bottom of the screen).
- The left right buttons should be next to one another and the pair should be anchored to the left
- The jump and fire buttons should be next to one another and the pair should be anchored to the right
- Each pair of buttons should take up at most 50% of the width of the screen, but depending on the resolution, there can be space in between the pairs
This first image shows my ideal setup. However, these were largely manually placed. Using the anchoring system in Unity, all the buttons are anchored to the bottom of the canvas. The left button is anchored to the left and the right most fire button is anchored to the right. However, the move right button and the jump button (the 1st circle button) aren’t fixed.
To demonstrate, here is a screenshot with a different resolution.
As can be seen, the move right button has shifted away from the left button. As has the left most circle button.
How can I create these “pairs” to neatly group some of these buttons? Are there resources on best practices and tips for creating ui layouts for Unity?
Thank you in advance!!