- Home /
Resizing multiple GUI Textures to remain together
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);
}
}
Are the buttons only meant to display when you are not in full screen? And the background only display when you are full screen?
So the background is set to full screen(which is all the check is doing). The buttons are in front of the background so it looks like the buttons are on top of the background. The reason for the check is because this script is on the background GUITexture(which has isFullScreen = true) and the button GUITextures(that aren't the same size as the entire screen)
Are you talking about adjusting the whole application's window or just a GUIWindow within you application?
its adjusting the whole application window, imagine having a windowed version of the game running and you make it bigger or smaller. Im wanting to scale that appropriately.