I’m doing the Tutorial and the slash screen will not show i have no ideal what i’m doing wrong heres the script please help. i’t says “ArgumentException: You can only call GUI functions from inside OnGUI.”
// Links the LerpzTutorialSkin asset
var gSkin : GUISkin;
// our backdropimage goes in here
var backdrop : Texture2D;
// if true, we’ll display the “loading…” message
private var isLoading = false;
// the backdrop
var backgroundStyle : GUIStyle = new GUIStyle();
// code checks to see if we have a valid GUI Skin Object
function OnGUI ()
{
if (gSkin)
GUI.skin = gSkin;
else
Debug.Log(“StartMenuGUI: GUI Skin object missing!”);
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), “Play”))
{
isLoading = true;
Application.LoadLevel(“TheGame”); // load the game level.
}
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”);
}
}
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”);
var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||
Application.platform == RuntimePlatform.WindowsWebPlayer);
// Make the script also execute in edit mode
@script ExecuteInEditMode()
379023–13117–$startmenugui_777.js (1.34 KB)