So I'm attempting to scale a GUI that stretches across the bottom of the screen, but if I click the maximize on play the texture disappears. Upon further investigation, if I scale the width from the original size before maximizing it, it will disappear(EDIT: it appears now, but it doesn't stretch across the bottom, rather stays stuck at 1024x64). Here are the code snippets I'm using for this.
EDIT: I've discovered the problem. Upon importing the GUI image for mainImage, it resizes it to 1024x64. My screen resolution is 1366, and Unity won't draw the image more than its size. I unchecked the box that said "compress textures on import," yet it still resizes the picture to 1024x64. The size of the picture before this compression is 3298x205. I know, not a power of 2. I have re - saved it as 2048x128, and it still resizes it 1024x64. This is really frustrating :|. How do I go about overriding the compression? I tried the "override for compression for web player and stand alone", but that prevents code from changing it. I also added the manual image.height = scaledHeight and image.width = Screen.width. I get this error that says "Exception: not implemented" and not much more that I can see as relevant.
//==================main==texture==variables======================================//
// main decoration textures:
var guiSkin: GUISkin;
var nativeVerticalResolution = 1200.0;
var mainImage: Texture2D;
private var mainImageOffset= Vector2(0, 0);
//==================main==texture==variables======================================//
function OnGUI ()
{
// Set up gui skin
GUI.skin = guiSkin;
DrawMainGUI (mainImageOffset);
// Our GUI is laid out for a 1920 x 1200 pixel display (16:10 aspect). The next line makes sure it rescales nicely to other resolutions.
GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (Screen.height / nativeVerticalResolution, Screen.height / nativeVerticalResolution, 1));
}
function DrawMainGUI (pos : Vector2)
{
var scaledHeight= mainImage.width / Screen.width * Screen.height;
var scaledResolutionWidth = nativeVerticalResolution / Screen.height * Screen.width;
GUI.Label (Rect (-pos.x , Screen.height - mainImage.height-pos.y, mainImage.width, mainImage.height), mainImage);
mainImageSize.width = Screen.width;
mainImageSize.height = scaledHeight;
}
How do I stop the compression of my texture imports?
Edit: removed stuff irrelevant to the problem.