Quantcast
Viewing latest article 18
Browse Latest Browse All 54

How to fix the positions of the buttons in any resolution

In my game,i am providing three buttons in the bottom of the screen,one for back,one for shuffle and one for settings.,i want to arrange them in a order that,whenever i open my game on any device buttons remain on their own positions,is it posible..?? void OnGUI() { GUI.Label( new Rect( 0, 40, 200, 50 ), "Timer: " +timerFormatted , mystyle ); GUI.Label( new Rect( 300, 40, 120, 50 ), "Moves: " +click , mystyle ); if (GUI.Button (new Rect (20, Screen.height - 60, (Screen.width/2)-100, (Screen.width/2)-20), "Back ",mystyle1 ) ) { displayDialog=true; } if (displayDialog) { windowRect = GUI.Window (0, windowRect, WindowFunction, "Save !!!"); } if (GUI.Button (new Rect (Screen.width/2, Screen.height - 60,(Screen.width/2)-100,(Screen.width/2)-20), "Shuffle ",mystyle1)) { ChangePosition(); } if (GUI.Button (new Rect ((Screen.width/2)-350, Screen.height - 60, (Screen.width/2)-100,(Screen.width/2)-20), "Settings ",mystyle1)) { Application.LoadLevel("Settings"); } } public void WindowFunction (int windowID) { GUI.Label( new Rect( 40, 40, 200, 100 ), "Do you want to save ?? " ); if (GUI.Button (new Rect (10, 70,70, 20), "Yes ")) { Himani(); Application.LoadLevel("level02"); } if (GUI.Button (new Rect (120, 70, 70,20), "No ")) { Application.LoadLevel("level02"); } }

Viewing latest article 18
Browse Latest Browse All 54

Trending Articles