problem 3D interface animation

I have a 3D button interface
on game first load it displays the game start interface
when I click a 3D button it spins 360 and then loads a level
with this script:

if(Input.GetMouseButton(0)) 
{ 
	animation.Play("interface_btn_rotate");
	yield WaitForSeconds(2);
	Application.LoadLevel("01"); 
}

when I hit ESC key it brings me back to the start screen
NOW, when I click a button it doesn’t rotate and neither is loading a level (simply put… the gane is dead at that point and I have to quit the game and start again)

It seems to me soo simple but aint working…
It has something to do with yield as well
because what happens is, without yield the button will not rotate but loads the level instantly ignoring the animation clip entirely.
And when WITH yield it only works once at first load of the game then dead…

So, any idea how this is possible to get it right?

I don’t see any reason for this not to work, there must be a problem elsewhere. I suspect a timeScale = 0.0; If I’m wrong I’ll move this into comments.

whilst you were posting… Thanks so much
meanwhile I was thinking about that time stuff
and came up with this.
That works out great to set the time to 1

made my day :slight_smile:

function Update()
{
    Time.timeScale = 1.0;
}

function OnMouseDown ()
{
    if(Input.GetMouseButton(0)) 
    {
        animation.Play("interface_btn_rotate");
        yield WaitForSeconds (2);
        Application.LoadLevel ("01");
			
    }	
}

that did the trick