void OnTriggerEnter(Collider collider) { //The projectile collided with an object DamageTaker dt = collider.GetComponent <DamageTaker>(); if (dt != null) //Do damage to the object { dt.TakeDamage(damageAmount); // Apply damage to the thing we hit Destroy(gameObject); // Destroy the bullet return; } }