- Home /
 
              This question was 
             closed Oct 09, 2014 at 05:31 AM by 
             Landern for the following reason: 
             
 
            The question is answered, right answer was accepted
 
               Question by 
               TheShadyColombian · Oct 09, 2014 at 05:31 AM · 
                collidertrigger  
              
 
              OnTriggerEnter() not recognizing collider
My health box has a script with OnTriggerEnter. it recognizes when something triggers it, and it recognizes what it is (By doing Debug.Log) but if I type if (ColliderName==GameObject.Find("Object")){} it doesn't perform whatever is in the brackets. i have used this code in many other scripts, and this is the only one that does not work. Here's the actual code I used:
 using UnityEngine;
 using System.Collections;
 
 public class ExperimentalHealthBox : MonoBehaviour {
 
     public GameObject Char;
     public ExperimentalDeath CharHealth;
     public float HealAmount;
     public Animator HUDAnimator;
     public GameObject DamageOverlayImage;
     public bool ManualHeal;
 
     public void Heal (float Amount) {
         HUDAnimator.SetTrigger("Heal");
         CharHealth.Health += Amount;
         Debug.Log ("Healing Player"); 
         Destroy (gameObject);
     }
     
     // Use this for initialization
     void Start () {
 
         DamageOverlayImage = GameObject.Find("DamageOverlayImage");
 
         HUDAnimator = DamageOverlayImage.GetComponent<Animator>();
 
         Char = GameObject.FindGameObjectWithTag("Player");
 
         CharHealth = Char.GetComponent<ExperimentalDeath>();
 
     }
 
     void OnTriggerEnter (Collider other){
 
         Debug.Log (other);
 
         if(other == !GameObject.FindGameObjectWithTag("Enemy") && !GameObject.FindGameObjectWithTag("PlayerBullet") && !GameObject.FindGameObjectWithTag("EnemyBullet")){
             Heal(HealAmount);
             Debug.Log("should be healing");
         }
     }
     
     // Update is called once per frame
     void Update () {
 
         if(ManualHeal){
             Heal(HealAmount);
         }
 
     }
 }
 
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by TheShadyColombian · Oct 09, 2014 at 01:03 AM
Silly Me! i forgot to put .gameObject after other inside if()