Problem when GameObject and its child have different layers.

For example there is two layers:
Layer “Triggers” and Layer “Items”

I want my main character move through items so I can put them in my inventory. (My game is 2D)
My items are on “Items” layer. I disabled interaction between layer on which my character is and “Items” layer. Then in order to be able to pick up items I need to interact with my items somehow. So I added to item a child with a BoxCollider2D which is trigger. And set its layer to “Triggers” layer. So now i have an object on “Items” layer with a child object on “Triggers” layer. My character can interact with “Triggers” layer. But it doesn’t work as I expected. When I try to interact with my item nothing happens. OnTriggerEnter2D function is not being called. But when I made my trigger object without a parent it worked perfectly. What am i missing there?

Sorry if there is a similar question which is answered. I tried to find an answer to this issue.
Thanks for help.

You shouldn’t need separate layers for this. Just put the items on the same layer as the player and set the Is Trigger property on their colliders.

Why are you setting them to separate layers?

I should have a non-trigger collider on my Items because I want them to interact with the ground. I don’t want them to fall through. They have a RigidBody2D and BoxCollider2D for that on “Items” layer. “Items” layer can interact with solid objects on my scene.
But I want my character to be able to pass through my items. (I don’t want my character to interact with its RigidBody2D)

So I set in collision matrix interaction between:

  1. My character and Solid.

  2. Items and Solid.

I’m facing a problem when I want to put a trigger collider on my items to be able to get OnTriggerEnter2D. (For picking them up when I’m passing through them). Since my Character doesn’t interact with “Items” layer I had to put a trigger BoxCollider2D on my items in another layer (“Triggers” layer). So I tried to make a child with a trigger BoxCollider2D on “Triggers” layer.

Very good question, I have a very similar problem, where child and parent have different layers. Would be happy to see a solution to this… some day …