OverlapSphere and QueryTriggerInteraction


i my PhysicsManager i turned off “Raycast Hit Triggers”. But now i want to include a few trigger colliders in a Physics.OverlapSphere. In the documentation there is this queryTriggerInteraction variable, which looks exactly like what i am looking for. But i cant find i way to use it. I always get compiler errors as if there is no such thing as a fourth variable in the OverlapSphere function.

my (working) code so far, not including trigger colliders:
Collider hitColliders = Physics.OverlapSphere(position, range, layerMaskSphere);

how do i use the “queryTriggerInteraction” part?

Best Regards

Edit: This functionality was added in 5.2!

If you want to perform a OverlapSphere that will activate triggers even though your global setting (in the physics manager) is set not to, just use the following code:

Collider[] hitColliders = Physics.OverlapSphere(position, range, layerMaskSphere, QueryTriggerInteraction.Collide);

Notice the last parameter, by default if left empty it will be QueryTriggerInteraction.UseGlobal, but we give it the Collide option to override the global value (which you set to ignore).