- Home /
Preventing all animations from playing?
This is the first time I've used the animations within Unity3d. For some reason when i activate the door animation, it causes all the other animations to play. How do i prevent all animations from playing when activating only one?
Iron gate script -
 using UnityEngine;
 using System.Collections;
 
 public class iron_gate_open_1 : MonoBehaviour
 {
         bool isGateOpen = false;
 
         void Update ()
         {
                 if (isGateOpen == false) {
                         if (gameObject.name == "iron_door_full_v001") {
                                 if (Input.GetMouseButtonDown (0)) {
                                         animation.Play ("iron_gate_open", PlayMode.StopSameLayer);
                                         isGateOpen = true;
                                 } else {
                                         if (isGateOpen == true) {
                                                 if (gameObject.name == "iron_door_full_v001") {
                                                         if (Input.GetMouseButtonDown (0)) {
                                                                 animation.Rewind ("iron_gate_open");
                                                                 isGateOpen = false;
                                                         }
                                                 }
                                         }
                                 }
                         }
                 }
         }
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Audio issue - Trying Waitforseconds 0 Answers
Animation keeps looping even on WrapMode.Once; 1 Answer
Unity Animation just play once 1 Answer
About Shooting With Gun 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                