- Home /
 
               Question by 
               willianbrasil · Oct 16, 2017 at 11:23 PM · 
                collision detectioncollisionsontriggerstay  
              
 
              Affecting multiple objects through trigger?
i have a trap that affect all enemies colliding with it, every frame i need to consume trap's energy and apply that effect. So i need to check if there's any enemy colliding with in order to consume that energy and apply the effect, how can i do that? OnTriggerStay isn't working and it seems that i'll have to use a list or something like that.
Thats the piece of code that i'm trying get working:
 private void OnTriggerStay(Collider other)
     {
         if (other.CompareTag("Enemy") && active == true)
         {
             other.GetComponent<Enemy_Manager>().Slow(lvl, multiplier);
             energy -= 0.5f;
             Debug.Log("slowed");
         }
     }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                