Works Great in Editor, Doesnt work on Phone

This sucks.

So a touch on a box lid sends the message “Loot” to this script. This script reaches to its parent, and plays an animation (Box open, or Box close). But it doesnt work on the iPhone build. The script works, because the audio Plays, but the lids dont move.

Any idea why it wouldnt work?

Thanks IA…

var boxOpen: String;
var boxClose: String;
var boxOpenSound: AudioClip;
var boxCloseSound: AudioClip;

var ready=true;
var whereTheAnimationsAre: Animation;
var open=false;

@script RequireComponent(AudioSource)

function Start(){
	whereTheAnimationsAre=GameObject.Find("TheHut").GetComponent(typeof(Animation));
}


function Loot () {
		
	if(ready)
	{
	
	if(!open)
	{
	
	audio.PlayOneShot(boxOpenSound);
	whereTheAnimationsAre.animation.Play(boxOpen);
	open=true;
	
	}
	
	else if(open)
	{
		audio.PlayOneShot(boxCloseSound);
		//switch off to avoid errant tappings/joystick.
	ready=false;
	whereTheAnimationsAre.animation.Play(boxClose);
	open=false;
	yield WaitForSeconds(2);
	ready=true;
	}
	
	}
}

I’m guessing its a bug.

Thanks
AC

I would be guessing its more a problem due to something else like vertex weights or timing

When you test it in the editor, and it works, are you using the unity remote, or a keyboard/mouse replacement? Just wondering if the input method is different, because I’ve never encountered any animation differences between the editor and the device, but different inputs might be causing your scripts to fire in different ways.

Heya, I’m testing using Unity Remote, with identical input. and the weirdest thing is that if I tap the box (in the build) long enough, the animations sometimes play. Theres four boxes, with the same code, just calling different named animations on their parent (Box1Open, Box2Open etc)and typically 1 will work (the last one I test) one will start to work after 20-30 touches and the other two wont…I filed it as bug report 362016 with full project source if any Utech bughunters are reading this.

Thanks guys.
Aaron