- Home /
Animations one by one
Hi, I have a problem with AnimationsClips. I wanna play 2 animations where one of them ("Animation 2") is in different GameObject. I made an reference "bags" to this GameObject, but it doesn't work. Everything is fine when i play only "Animation 1" which is part of appropriate GameObject but what about "Animation 2"? I think that I need to use AddClip, but i tried to and it didn't help me either;( This is my code:
 public class P1_skr : MonoBehaviour {
     
     public GameObject bags;
     public Transform prefab;
     public AnimationClip benkizer;
     public Animation anim;
     // Use this for initialization
     void Start () {
 
         
         
     }
     
     // Update is called once per frame
     void Update () {
         if (Input.GetKeyDown (KeyCode.Space)) {
             Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);
             GetComponent<Animation> ().Play ("Animation 1");
 
             if (Input.GetKeyDown (KeyCode.Tab)) {
             bags.GetComponent<Animation> ().Play ("Animation 2");
             }
         }
     }
 }
Thank you for your help and sorry for my bad english; )
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                