SOLVED: 3D Platformer Tutorial : GUI

I’ve been going through the tut with no problems until I got to the GUI section. I’m at the end of page 62 (done with start menu and just added sounds) where I’m supposed to be able to hit Play to see the menu in action. The problem is I only see a blue screen. The audio loops correctly, and there are no errors in the console. Also, I’ve gone over the script several times for typos and such but found none. I’m pasting the code below to see if I’ve somehow missed something.

@script ExecuteInEditMode()

var gSkin : GUISkin;
var backdrop : Texture2D;

private var isLoading = false;

function onGUI() {
	if (gSkin) {
		GUI.skin = gSkin;
	}  else {
		Debug.Log("StartMenuGUI: GUI skin object missing");
	}

	var backgroundStyle : GUIStyle = new GUIStyle();
	backgroundStyle.normal.background = backdrop;
	GUI.Label(Rect((Screen.width - (Screen.height * 2)) * 0.75, 0, Screen.height * 2, Screen.height), "", backgroundStyle);

	GUI.Label(Rect((Screen.width / 2) - 197, 50, 400, 100), "Lerpz Escapes", "mainMenuTitle");

	if (GUI.Button(Rect((Screen.width / 2) - 70, Screen.height - 160, 140, 70), "Play")) {
		isLoading = true;
		Application.LoadLevel("TheGame");
	}

	var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||  Application.platform == RuntimePlatform.WindowsWebPlayer);
	if (!isWebPlayer) {
		if (GUI.Button(Rect((Screen.width / 2) - 70, Screen.height - 80, 140, 70), "Quit")) {
			Application.Quit();
		}
	}

	if (isLoading) {
		GUI.Label (Rect((Screen.width / 2) - 110, (Screen.height / 2) - 60, 400, 70), "Loading...", "mainMenuTitle");
	}
}

function Update () {
}

I’m running Unity 2.5 Windows. Haven’t tried it on my Mac yet.

The tiniest damn typo… onGUI instead of OnGUI. :slight_smile: