Hi guys and gals, I recently bought the Indie version of Unity and truly love it, thank you devs!!! I’m still learning Boo script and was wondering if you folks might know the answer to my following question:
I’m working on my first 3D app and have coded 3 scenes so far: splash screen, intro game menu, level one. I got the intro menu working and loading the first game level perfectly. My only problem which I’ve been trying to figure out for the past day is I want to have the first splash screen pause for like 5 seconds so that the app has time to display the maya fbx animation before switching to the intro menu screen. I tried adding ‘yield new WaitForSeconds(5.0)’ but get an error that OnGUI cannot be a coroutine so I figured that yield cannot be used in the function OnGUI(). Here’s the script added to the splash.scene main camera:
// Make script execute in edit mode
@script ExecuteInEditMode()
var gSkin : GUISkin;
var backdrop2 : Texture2D;
private var isLoading = false;
function OnGUI()
{
if (gSkin)
GUI.skin = gSkin;
else
Debug.Log ("SplashMenuGUI : GUI skin object missing!");
var backgroundStyle : GUIStyle = new GUIStyle();
backgroundStyle.normal.background = backdrop2;
GUI.Label ( Rect (0, 0, 480, 320), "", backgroundStyle );
GUI.Label ( Rect (( Screen.width / 2 ) - 197, 50, 400, 100 ), "", "splashMenuTitle" );
var ix = 1;
if ( ix < 500000 )
{
ix++;
}
Application.LoadLevel ( "intro" );
}
I added the var ix = 1; if loop as an experiment to see if that would execute up to 499999 times and maybe give me the 5 seconds I need to display the splash screen animation but it only pauses for like 1 second.
How can I pause the first scene please? Thanks in advance for the help.