Newbie "Build and Run" Troubles

Hello there,

I’ve started evaluating Unity3D but have run into a hiccup which is probably something really simple but I cant figure out whats wrong.

I have two scenes:

  • A splash screen with a GUITexture displaying an image with an attached script and an attached audiosource
  • A testlevel containg a terrain and basic lighting

The GUITexture’s script plays a sound after 1 second, moves the texture and loads the next level after 5 and looks like this:

var playedSound = false;
var loadedNext = false;
function Update () {
	transform.Translate(Time.deltaTime * 0.1,0,0);
	if ((Time.timeSinceLevelLoad > 1)  (playedSound == false))
	{
		playedSound = true;
		audio.Play();
	}
		if ((Time.timeSinceLevelLoad > 5)  (loadedNext == false))
	{
		loadedNext = true;
		Application.LoadLevel(1);
	}
}

This project runs fine in unity itself (moves, sound is played, level is loaded), but in the web or standalone player the texture does get displayed but nothing else happens, as if the update() function wasn’t being called (no movement, no sound, no level load).

The console log (macosx here) states only that it couldnt find the ScreenSelector image, but according to my forum search is is normal if I dont have one aleady and shouldn’t have this effect.

Anyone have an idea of what i’m doing wrong? If not, anyone have an idea of how to debug this?

Thanks in advance

After 3 hours of checking logs, rewriting code etc nothing helped.

I quit unity (saving all changes), relaunched unity only to find that the script was now not attached to the guitexture and hence now the editor preview was behaving like the player was. I reattached the script, hit build and run and presto, it worked…

Weird.