Question by
akshayejh · May 16, 2016 at 03:18 AM ·
animationunity 2dmultitouchstate
Unity Multi Application Problem
I'm trying to play two animations at same time for two different objects.
if(Input.touchCount > 0){
for(int i = 0; i < Input.touchCount; i++) {
if(Input.GetTouch(0).phase == TouchPhase.Began){
Touch touch = Input.GetTouch(i);
if (touch.position.x < Screen.width/2)
{
car_one_file.car_one_instance.Perform_switch ();
}
else if (touch.position.x > Screen.width/2)
{
car_two_file.car_two_instance.Perform_switch ();
}
}
}
}
This is the code for multi touch and, which "Perform Switch is called it plays animation for object one and two, the problem is it is not working, it only plays, single animation at a time.
Comment
Are those car_one_instance and car_two_instance pointing to different instances? How do you get them?
thanks for replying :-)
I found the solution,
I was just referencing "GetTouch(0)" on line 5 ins$$anonymous$$d of "i"
Your answer
![](https://koobas.hobune.stream/wayback/20220612080857im_/https://answers.unity.com/themes/thub/images/avi.jpg)