Making this in the top right corner? (GUI)

How can i make this in the top right corner?

var names = QualitySettings.names;

for (var i = 0; i < names.Length; i++)
{
	if (GUILayout.Button (names*))*
  • QualitySettings.SetQualityLevel (i, true);*
    }

you mean the GUI layout Button...

–

2 Answers

2

Im assuming you talking about the button (;
do you know about Layout areas? well you will need them in this case because your using a loop. define them in the loop so that the Y coordinate increases each loop. so they will not draw over each other. set the areas x pos to Screen width - button width to make in the right, and y to 0 + i * (insert you height here) to make the list go downwards. the width and height of the buttons is up to you.

for more info read this:

   var names;

function Awake() {
 names = QualitySettings.names;

}
function OnGUI() {
    
   
    for (var i = 0; i < names.Length; i++) {

        GUILayout.BeginArea(Rect(Screen.width - 130, 0 + 20 * i, 120, 30));
        if (GUILayout.Button(names*)) {*

QualitySettings.SetQualityLevel(i, true);
}
GUILayout.EndArea();

}

}

yeah... QualitySettings.names is one of those function you have to call in Awake or Start(), I forgot to put that in, I've edited it now

–

Thanks alot :D

–

use this code :

        GUILayout.BeginArea(new Rect(position.width - 60, 0, 60, 30));
        if (GUILayout.Button("name"))
        {
            // your btn what do
        }
        GUILayout.EndArea();