How to NOT detect child collider

I have gameObject with my script, Rigidbody2D and BoxCollider2D. This object has child with BoxCollider2D (trigger).
My script on parent object has OnTriggerEnter2D and OnTriggerExit2D.
When parent or (!) child object’s collider enters some other BoxCollider2D script detects collision.
I need to detect only parent’s collider collisions.
Any suggestions?

You should use layers for your collision. Using layers you can specify which objects interact with each other. See the Unity manual for help. Unity - Manual: Layer-based collision detection

I Get the same problem but here’s the deal: My laser gameObject should be colliding with the Enemy normally, but they as a child of the Player, shouldn’t collide with the enemy, (to detect if the player is hit) How can I do this? Or the only solution is to get the laser as a child of a temporary GameObject