3DPlatform tutorial - script locks up Unity

Hi there, this will be my first post as a Unity user! Very excited!

Im working through the 3D platform tutorial, and Im at the Game Over GUI part. When I drop the Script onto the camera, this is displayed in the Debug bar at the bottom of the screen:

IsD3D9DeviceLost() || g_D3DInsideScene

Unity freezes up and I need to kill the process. I copied the script from the PDF to make sure I didn’t make a mistake:

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

var gameOverScale = 1.5;
var gameOverShadowScale = 1.5;

function OnGUI()
{
GUI.Label ( Rect( (Screen.width - (Screen.height * 2)) * 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 / (2 * gameOverShadowScale)) - 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 / (2 * gameOverScale)) - 150, (Screen.height / (2 * gameOverScale)) - 40, 300, 100), "Game Over", gameOverText);
}	

@script ExecuteInEditMode()

Any ideas? Is the script somehow incompatible with 2.6?

Hi, welcome to the forum!

It seems to work OK here on 2.6 but this is on a Mac, so it might be a fault with the Windows version. Try commenting out the ExecuteInEditMode line at the end and see if you get any different result. You should also try running the scene to check it doesn’t crash then either.