Hey guys,
I am building an interface with buttons on the bottom. My target res is 320 x 480, I am finding that with different higher resolutions the buttons are moving towards the center of the screen depending on the higher the resolution is of the device.
How can I make it so these buttons stay at the bottom no matter what res the device is.
Please do share your success so others may learn Please and Thanks
Just use GUILayout, so you can place everything resolution-independently.
For example, to have a button always stay at the bottom left of the screen:
GUILayout.BeginArea( new Rect( 0, 0, Screen.width, Screen.height ) );
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
if ( GUILayout.Button( "MyButton" ) ) {
// Button action.
}
GUILayout.EndVertical();
GUILayout.EndArea();
I knew about the GUI Layout but didn’t see the FlexibleSpace before Thanks Izitmee.