My code doesn’t show any errors, but doesn’t take health away. The point is that if my fireBall collides with an enemy the enemy loses as much health as there is damage. here’s the script :
void OnTriggerStay(Collider other)
{
if (other.GetComponent<removeHealth>())
other.GetComponent<removeHealth>().health -= damage;
}
and yes I have an object that has a script removeHealth active. removeHealth also has a public health float in it.
@Dhicci
If you’re using “Trigger”, make sure “Is Trigger” is checked on the “other”, but I would suggest using OnCollisionEnter(Collision col).
Also before actually taking the health away, to make sure that collision actually occurs, try Debug.Log(“Collided”);