I am making a 2D Game with Unity 5 and I have a problem with child GameObject collider. I want to detect a collision between a Child GameObject with another object, doing this from the parent script and using tags.
Follow my parent script below:
void OnCollisionEnter2D(Collision2D hit) {
if(hit.transform.tag == "Enemy"){
this.playerRigidbody.AddForce(new Vector2(0, this.forceJump));
}
}
The "Enemy" tag is another object that is colliding with the collider of my player child. I want to detect the collision between the child object and that another object, I searched in many similar forums about Unity but I couldn't solve my problem. Someone can help me with this problem?