3D Platformer Tutorial (433275)

I’m running Unity3 and working my way through the platformer tutorial, albeit the Unity2 version. I have got as far as the Game Over Screen (pps 65 - 70). I have followed the text to the letter but I cannot get the screen to display. Is there something wrong with the explanation or the script?

Best wishes

Tony Holland

Can you explain what you want to do for those of us who don’t have the tutorial on hand?

Thanks chubbspet.

I’m trying to display a “game over” splash screen. I’ve set up a scene, attached the relevant script and the splash screen image, all as desribed in the tutorial. However, when I activate the scene I simply get a blank (blue) screen in the Game panel. I have set up a similar splash screen for the start up menu, and that works perfectly. Below is the script that I am using:

@script ExecuteInEditMode()

var background : GUIStyle;
var gameOverText : GUIStyle;
var gameOverShadow : GUIStyle;

var gameOverScale = 1.69;
var gameOverShadowScale = 1.61;

function onGUI()
{
GUI.Label(Rect((Screen.width - (Screen.height2)) 0.75, 0, Screen.height*2,
Screen.height), “”, background);

GUI.matrix = Matrix4x4.TRS(Vector3(0, 0, 0), Quaternion.identity, Vector3.one*
gameOverShadowScale);
GUI.Label(Rect((Screen.width/(2gameOverShadowScale)) - 150, (Screen.height/(2
gameOverShadowScale)) - 40, 300, 100), “Game Over”, gameOverShadow);

GUI.matrix = Matrix4x4.TRS(Vector3(0, 0, 0), Quaternion.identity, Vector3.one*
gameOverScale);
GUI.Label(Rect((Screen.width/(2gameOverScale)) - 150, (Screen.height/(2
gameOverScale)) - 40, 300, 100), “Game Over”, gameOverText);
}

I have set the GUIStyle variables in the Inspector, again as described in the tutorial.

The only difference between the screen that doesn’t work and the one that does work is the use of GUIStyle in the former. Has this changed between U2 (on which the tutorial is based) and U3?

Change “onGUI()” too “OnGUI()” and make sure you’ve made the Game Over GUI script a component of the Main Camera game object in the Hierarchy panel.

Hope this helps!

~Will

Many thanks Skewl. The number of times I looked over the script and didn’t see such an obvious mistake! Thanks for pointing it out; it did indeed help.