- Home /
Scale GUITexture to screen resolutions
I just did a Main menu with an Emty GameObject (MainMenu) contains a GUI Texture (GameObject) so I want to scale it because if you change the screen resolution the buttons can't be visible.
Here an example of my code
var MainMenu : GameObject;
var OptionsMenu : GameObject;
var Options : GameObject;
function OnMouseDown()
{
if(this.name == "Button_Options")
{
MainMenu.SetActive(false);
OptionsMenu.SetActive(true);
Debug.Log("Loading Options Menu");
}
}
If you can help me I'll love you for ever :3
Answer by meat5000 · Apr 26, 2014 at 11:21 PM
Instead of using the borders and Pixel insets of the GUITexture, adjust the scale and transform instead to values between 0 and 1, of the object the GUITexture is placed on.
It will remain consistent at all resolutions.
Your answer
Follow this Question
Related Questions
Bulletproof way to do resolution independant GUI scaling? 2 Answers
Best approach to define interactive screen areas regardless of it's resolution? 3 Answers
[Android] Screen Scaling?! 0 Answers
How to maintain high resolution custom background images for GUI elements on different screen sizes? 0 Answers
Locking Object To Screen 1 Answer