GUI on Android device much smaller

Everything is working okay, but when I build and run the GUI buttons on my Android device (Samsung Note 3) are much smaller than they are in the game preview. All of the other game objects appear the same size in the preview as they do on the device.

Is there anything I can do to update the preview to match how the device will display the game? Anything else I can do to make sure that the GUI elements and screen size will be consistent between the two?

2 Answers

2

If you are using Unitys immediate GUI (GUI.Button etc), you can scale the GUI with GUI.matrix. You need to know what a matrix is and how to manipulate it, but in your most simple form, all you’d do is multiply it with a Scale matrix.

The idea is that you upscale your GUI. It means that you won’t get as crisp GUI (since the resolution appear to be greater on your phone than your editor) but you should be able to get it consistent.

See/search existing answers. Example: http://answers.unity3d.com/questions/150736/script-gui-units.html

if you dont use gui matrix, i use the screen height mostly to scale stuff so i can keep aspect ratios for my icons

	//i use height on widescreen for both heigh and width so it scales uniformly
	GUI.Button (Rect (Screen.height*.05, Screen.height*.05, Screen.height*.25, Screen.height*.25), "square");

	
	GUI.Button (Rect (Screen.width/2-Screen.height*.25/*half width*/, Screen.height/2-Screen.height*.125/*half height*/, Screen.height*.5, Screen.height*.25), "centered rectangle");