i added OnGUI buttons to my game
but it scale changes on each device
how can a stop that ? and make it one size for all devices ?
If you’re currently using absolute sizes, the button’s won’t appear where you might want them.
You might want to make them just take up a percentage of the screen, and use Screen.width/Screen.height when creating them.
Rect brush = new Rect(0, 0, Screen.width * .5f, Screen.height * .1f);
if (GUI.Button(brush, "This button takes up half the screen's width.")) {
//Do whatever
}
Then you can make buttons at any part of the screen:
//Make a rect in the middle center of the screen:
Rect rect = new Rect(Screen.width * .333f,
Screen.height *.333f,
Screen.width * .333f,
Screen.height * .333f);
GUI.Box(rect, "This is in the middle of the screen");