- Home /
GUI Resolution Ajust
How do I do to Make the GUI fit to the screen resolution, so when the resolution resize the GUI fit the resolution.
Here the Script
function OnGUI () { if(municaoSelect){
(GUI.Button (Rect (guix,guiy,300,20), "Aperte E para pegar " + municao + " de municao."));
}
}
Answer by robert_mathew · Jan 01, 2012 at 05:24 AM
GUI.Button(new Rect(Screen.width * (1f/6.55f),Screen.height * (0.1f/6.3f),Screen.width * (4.8f/6.55f), Screen.height * (0.85f/6.3f)),"Click"); //c#
GUI.Button(Rect(Screen.width * (1f/6.55f),Screen.height * (0.1f/6.3f),Screen.width * (4.8f/6.55f), Screen.height * (0.85f/6.3f)),"Click"); //java script
this will adjust the GUI depending on screen reslotion
is there a script for a toggle button like : GUI.Toggle(Rect(Screen.width * (1f/6.55f),Screen.height * (1f/6.3f),Screen.width * (2f/6.55f), Screen.height * (0.5f/6.3f)),"Start Game", "Button");
if I use that it logs an error : BCE0023: No appropriate version of 'UnityEngine.GUI.Toggle' for the argument list '(UnityEngine.Rect, String, String)' was found.
cheers :)
Your answer
Follow this Question
Related Questions
GUI Scale Problem 1 Answer
GUI and Screen Resolution 1 Answer
Dealing with GUI size on iPhone 1 Answer
[Android] Why does my enemy die no matter where I am in the 3D environment? 1 Answer