SM2: Playing Multi Anims with One Touch

Hi

My scenerio is this. I want the user to touch one object on the screen (a Packed Sprite object using SpriteManager2) to start playing animations. There are 2 animations to play - the one attached to this object (that has a box collider) and another animation attached to a different sprite object in the scene.

The code I’m using is as follows. The problem is that it plays the first animation (the one attached to the object the script is living on), but it doesn’t play the animation for the second sprite.

Anyone have any ideas on how to get around this? Many thanks for incoming advice. :smile:

var sprite1 : PackedSprite;
var sprite2 : PackedSprite;
var Anim1 : String;
var Anim2 : String;
var ColliderBox : Collider;


sprite1 = GetComponent (typeof (PackedSprite)) as PackedSprite;
sprite2 = GetComponent (typeof (PackedSprite)) as PackedSprite;

private var hit : RaycastHit;
private var ray : Ray;



function Update() {
	

	
	if(iPhoneInput.touchCount > 0 )	
	{
		var touch: iPhoneTouch = iPhoneInput.touches[0]; 

 		if (iPhoneInput.GetTouch(0).tapCount == 1 )
 		
 		{ 			
 			
 			var ray = Camera.main.ScreenPointToRay (touch.position); 
                if (Physics.Raycast (ray, hit, 100)  (hit.transform == transform)) 
                {
                	
 				
 				Destroy(ColliderBox);
 				sprite1.PlayAnim(Anim1);
 				sprite2.PlayAnim(Anim2);
 				  				
 			}
 				
 		}
 	}
}

p.s. this is on iPhone

p. p.s. this is on iPhone

I’ve moved this query to the iOS SpriteManager2 thread. Sorry should have put it there in the first place! Feel free to delete this post!