- Home /
 
               Question by 
               JoBrindley · Apr 25, 2013 at 04:03 PM · 
                animationcollidertriggerdestroy  
              
 
              Destroy trigger so animation only plays once.
I have an animation that is triggered when I walk through a collider. But I'm wanting the collider to be destroyed after walking through it so the animation only plays once. As at the moment, it plays every time I walk through it. I have this script, but it doesn't seem to be working. Can anyone help me please?
 function OnTriggerEnter(thing: Collider){
   if (thing.tag == "Basement_trigger"){
     Destroy(thing.gameObject);
   }
 }
               Comment
              
 
               
              Do you really want to destroy your gameobject ? If not, you can disable your collider :
 thing.enabled = false;
Answer by Paulius-Liekis · Apr 25, 2013 at 05:36 PM
Destroy(thing); - this will destroy Collider component only.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                