So the problem im facing is that I am using a GUITexture to display a background image. Then in front of that Im using a different GUITexture to display the button images. I managed to get it so i can adjust the window to whatever size to adjust the background image however the GUITexture that is holding the button images is not adjusting correctly and going off screen. Any insight on a good what so that they will always been lined up regardless of how its scaled. Heres my current OnGUI()
void OnGUI()
{
if (isFullScreen)
{
//Background Image
this.transform.position = Vector3.zero;
this.transform.localScale = Vector3.zero;
this.guiTexture.pixelInset = new Rect(0, 0, Screen.width, Screen.height);
this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z + depth);
}
else
{
//Button Textures
this.transform.position = Vector3.zero;
this.transform.localScale = Vector3.zero;
this.guiTexture.pixelInset = new Rect(xPos, yPos, Screen.width - xSize, Screen.height - ySize);
this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z + depth);
}
}
↧