Trigger the Animation #2 after Animation #1 was triggered
Hello,
I created 2 buttons with actions so when they collide an animation is triggered on a GameObject.
However, on the second button, I want it to play the respective animation, only if the first one is/was triggered first.
I might be doing something wrong on the code.
 using UnityEngine;
 using System.Collections;
 
 public class Actions : MonoBehaviour {
 
     public Animation anim_GameObject;
 
     void Start () {
     
     }
 
     public void act(string name)
     {
         if (name=="triggerExpand") // #1
         {
             anim_GameObject.Play("expand");
 
         }
         else if (name=="triggerCollapse" && anim_GameObject.IsPlaying("expand"))
         {
             anim_GameObject.Play("join"); // #2
         }
         else 
         {
             Debug.Log ("action was not defined");
         }
     }
 }
The animation #1 is being triggered by the "triggerExpand" and the animation #2 should only "triggerCollapse" if it is already playing the #1.
Can anyone help me fix this? Really appreciate.
Rui
Your answer
 
 
             Follow this Question
Related Questions
How do i extend a animation ? 1 Answer
How do I not trigger animation during play state of the triggered animation. 1 Answer
Need help with animating HP bar 1 Answer
How do I rotate specific joints/bones using a script? 0 Answers
is there a way to make an animation global instead of relative to parent? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                