A couple newb scripting questions

I’m working on an intro scene for my project and i’ve gotten everything working the way i want, just a couple final details to work out.

I’m coming from an art background, so scripting is pretty difficult for me to understand so bear with me.

First,here’s my script to exit the intro screen and start the game

var mySound : AudioSource;

function Update () {
if (Input.GetButtonDown ("Start")) {
mySound.Play();
animation.CrossFade ("SceneFadeOUT"); 
Application.LoadLevel ("TestLevel1");
	}
}

What i’m unable to achieve is disabeling the input on “start” for 3 seconds, and secondly i need a delay between
animation.crossfade (“SceneFadeOUT”)

Application.LoadLevel (“TestLevel1”);

i’ve been trying different things for the past day or so to no avail. I’ve read into WaitForSeconds, but i’m unsure how to implement it in my script since it wont work alongside an Update function…

Sorry for the beginner questions, but i’m in need of some help here. Thanks!

You can’t put WaitForSeconds in Update. Make a function loading your level, put the WaitForSeconds the that function. In Update, call that function when you click on the button, it will work.

hey thanks, i got that working just the way i needed it.
Any ideas for disabling the input for a set time?

Have a value for “loading” or something and set it to false. Then in onUpdate have it check if(loading == true)…just hang out…else{ get input}.

sorry, that one’s got me a bit confused, could you show me an example?

I’m not a Javascript guy, but from what I have seen…

var isLoading = false;

OnUpdate(){

if (isLoading == false)
{
if (Input.GetButtonDown ("Start")) { 
mySound.Play();
isLoading = true; }
else
{
//Do nothing, because we are waiting for the scene to transition
}
}

This isn’t the most optimized way to do things, but since it is your loading screen, there is not a huge need to get crazy.

If you do nothing, why do you even put an else :?:

Mostly, just for illustrative purposes to show that we are doing nothing. But yes, it is not needed in this specific case.

thanks guys, got it working great