- Home /
How can I prevent my GUI background texture from getting pixelated or stretched?
Hello,
I have a high res image that I would like to use for my background of my GUI menu (1600 x 1200), but I cant seem to get it right. Its either stretched or pixilated.
I'm currently using this to display my image:
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height),
MenuBackground, ScaleMode.StretchToFill,
true, 10.0f);
I have also made the image true colour and given it a size of 4096.
With that current code - it looks pixilated. (I would like to keeps its ratio too)
Please help ... Thanks, Ollie
Answer by Bravini · Dec 16, 2010 at 08:25 PM
make an empty GUITexture Object and drag your texture onto it
edit: you don't need to script it if you use a GUITexture gameobject, but if you don't, use ScaleAndrop instead of StretchToFill
How do I make that dynamic to the screen size and yet maintain ratio?
you can use a script that acess this guitexture attributes like any gameobject, I do this mostly for title screens.
Right? Thats what I've done (read my post). But it doesn't display it properly - its either stretched or out of ratio
you got me wrong, you're using a gui.drawtexture, i mean for you to use a guitexture gameobject. Also, if you use StretchToFill, it gonna stretch and get pixelated, try ScaleAndCrop