Does OnTriggerStay ignore layers?

My game has collectable/harvestable resources (food and so on). All of these objects are in their own layer (“Resources”). The player may have multiple units, which are all on the “Player” layer. Through the Project Settings > Physics settings, I have set the Resources layer to only interact with the Player layer. The collectable colliders are set as triggers. So far, so good.

With a single collectable, the OnTriggerEnter and OnTriggerLeave will trigger appropriately, and add slowly to the player’s inventory until the resource is depleted or they move away.

The trigger area is larger than the 3D model, and it’s possible for the player to be close enough to collect multiple resources at the same time. When this happens, the “first” collectable takes priority and the second will wait until the first has been depleted before the player can start collecting it. In this situation, OnTriggerStay will periodically poll to see whether it’s OK to to begin collecting the second resource. This code all works and does what I want it to do.

The problem is that as soon as OnTriggerEnter is called on the second resource (by the collider on the Player layer), the log starts getting spammed by OnTriggerStay collisions by the terrain collider (which is on a separate “Water” layer that should not be colliding with Resources). Does anyone know why this would happen? It seems as if OnTriggerStay is reporting all collisions on all layers once the trigger collider has been activated. It’s not breaking my code because I’m doing other checks, but I set up the layers and collisions to avoid unnecessary physics. What am I missing?

I was wondering this myself. Came across this question, which is similar and has an answer that seems useful.