Fullscreen start image for all devices?

Hi,
I’m trying to make a fullscreen start image (just an image with some instructions) that you can click away to start the game.
So I’ve decided to add a GUI.Button with:

if (GUI.Button(new Rect(0,0,Screen.width*horizRatio,Screen.height*vertRatio), _splash[_sstate], GUIStyle.none)) {
	_sstate=1;
}

_splash is a GUITexture Array with an image and a blank slot (_sstate 1).

To resize the GUI I use:

function Start(){
	horizRatio = Screen.width / 800;
	vertRatio = Screen.height / 480;
}
...
GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (horizRatio, vertRatio, 1));

But the button only looks good in 800x480. It won’t be scaled bigger when I switch to a different size. And if I use a bigger image and scale it down I have problems to position it in the middle.
Do I have to use a seperate image for all aspect ratios and sizes?

use a guitexture instead, set scale to x=1,y=1 and that will be fullscreen, make sure you set all the pixel inset values to 0.

Ok, thanks. I’ve added a guitexture. That looks better. But how can I put the guitexture in front of the my other game gui.buttons (inside OnGui())? If I change the z-order it doesn’t do anything.

I use the z order and it works for me, havn’t tried in front of gui.buttons though i would assume it would work the same…

I don’t think you can draw on top of OnGUI elements. You might need to just add logic to your OnGUI to skip drawing if the instruction screen is visible.

ok i’ve change all GUI stuff to GUITextures and it works fine now inside Unity. Switching resolutions works as expected, menubar is always at the bottom. BUT when I export it to my Nexus S I have a strange problem:

  • Screen.width / height is 800x480.
  • landscape left
  • fullscreen splash is set to scale 1,1,1
  • menubar is set to y 1

inside unity it looks fine but on the device everything is stretched about 35px in y! Any idea why?

strange: setting the y-scale to 0.85 looks better. Shouldn’t y-scale 1 exactly fit the screen?