Why my "Is Trigger" box colliders are physically colliding with other colliders?

Hi all and thank you for your time.

In my scene, I have terrain trees with Capsule Colliders and other GameObjects some with Box Colliders, some with Mesh Colliders.

All of them are colliding with my Player, my AI enemy character and the bullets from weapons. (all of them with a Rigidbody and a Capsule Collider)

I tried adding another collider on all “flammable” objects that I have in my scene, to trigger a fire effect based on collision triggers through a script. (For example my terrain trees and some GameObjects like tree stumps)

To do that, I’ve added an extra Box Collider with “Is Trigger” checked.

The script worked but to my surprise, all the new Box Collider triggers are acting as normal colliders! Everything from my character to my bullets are now colliding with the Box Colliders that have “Is Trigger” checked instead of the original Capsule or Mesh colliders the objects have!

At first, colliders and triggers were on the same child object but I’ve also tried adding the trigger to another child object, tried to add the trigger on a child of the child with the collider, tried adding the trigger on the parent object but always the same thing, the trigger is colliding as if it’s not a trigger at all.

As a last resort, I tried adding the triggers on a different Layer called Fire and then unchecking EVERY other Layer in the “Layer Collision Matrix” to disable collisions with everything on the scene.

The magical Box Colliders with “Is Trigger” are STILL colliding with everything completely ignoring the Layer Collision Matrix!

Needless to say that I have no clue as to what is the problem and what I should check next.

My project is a 3D project and I’m using the built in renderer (no URP or HDRP) with Unity version 2020.2.2f1

(So I guess the collision matrix of the Physics 2D has no effect, right?)

Any help from you will be highly appreciated.

I finally solved the problem.

To anyone with a similar issue, here is what was happening:

It was actually a 2-part problem.

Part-1: The terrain trees
On my prefab trees I had 2 colliders, one was a capsule collider with actual collision enabled and a box collider that was checked as trigger.

When Unity is placing trees on the terrain, all of them become part of the terrain mesh (the trees are not GameObjects on the terrain) and through that process, Unity is “reading” all the colliders on the tree prefab and using them as colliders on the terrain tree.

On that process Unity doesn’t care if a collider is checked as trigger, it will use all colliders on the prefab as non-triggers and that is why my character, AI & bullets are colliding with the trigger.

To solve the issue, I disabled the child object with the trigger and added a very simple script on the prefab that will SetActive(true) the child object on Start.
That way the terrain will not use the box collider at all, my fire script will replace the terrain tree with the prefab on run-time to start the fire effect and when that happens, the script will enable the trigger.

Now you may be wandering, how does this fix the collision problem with the GameObjcets? Here is where part 2 comes in.

Part-2: GameObjects
I use a “Third Person Template” Asset on my project for the Player and the AI, so it was difficult to find out if a script was raycasting, causing all this.
To make sure that no collision was enabled, I disabled everything in the Layer Collision Matrix on the Fire layer and I thought that was it.

However after reading MelvMay’s reply above that “Queries have their own LayerMask filter arguments” I tried to find a way to disable raycast collisions as well.

So in the end it was very simple, I used “Physics.queriesHitTriggers = false;” to stop raycasts from interacting with the trigger and everything worked as expected! It was indeed a script that was stopping my characters and my bullets, not an actual collision.

After that I tried to simply change the Layer to “2: Ignore Raycasts” and it’s also working as expected.

Thank you all for your time and invaluable help!