I have a gameObject that has a 2d box Collider trigger (hitbox) and has a child that also has a 2d circle Collider trigger(detection zone). I was wondering if there was a way to only call onTrigger on the parent’s collider ONLY. Currently the player will take damage when it enters the detection zone and when it enters the hurtbox.
void OnTriggerEnter2D(Collider2D col) {
GameObject colObj = col.gameObject;
PlayerController thisPlayer = colObj.GetComponent<PlayerController>();
if (colObj == null) {
return;
} else if (colObj.tag == player) {
thisPlayer.TakeDamage(damage);
}
}