How can i detect how many objects of the same type i'm triggering and choose only one of them?

Hi, i’m italian and my english is not good so… sorry!
I’m developing a 2D game. In this game i can control a lumberman, so I can cut trees and move the wood wherever I want. if I do not have wood on me and the trigger detect the wood on floor, when i press “E”, he takes the wood. The problem comes when i’m triggering 2 pieces of wood! In this case he collect both of them but, of course, then i have only 1 wood on the lumberman.
I need to write a code that recognizes when I’m touching more than one object of the same type and, by pressing the “E” key, collect only one of these. Can someone help me?
Thank you

depends on how you plan to do it. Unity triggers events are only triggered by 2 colliders, so even if your lumberman is triggering multiple colliders, you wont receive one trigger message with all the colliders, but multiple trigger messages (one per collider in trigger). i think you dont really need to know when you are touching more than 1 object, since you can just pick up the first object and set a bool variable to hasTakenWood = true. and only take the wood if that var is set to false. if for some reason you need to know how many woods you are colliding with use the ontriggerstay for adding each collider of type wood he is getting trigger with and add it to a list. and in the fixedupdate clear that list.