'setting NavMeshQueryFilter.areamask to Default Area doesn't work properly in unity

hey so i wanted to create a costume navmesh using NavMeshSurface and NavMeshModifierVolume, however, I have come to a conclusion that if I do something like NavMeshQueryFilter filter.areaMask = (1 << NavMesh.GetAreaFromName("Walkable"));, with Walkable being the Default Area on the NavMeshSurface for the particular agent, it will set the whole NavMesh as the AreaMask because this is the default. I noticed this happening because I set most of the NavMesh to a different Area (using NavMeshModifierVolume), however it doesn't filter them if I use the filter.areaMask in something like SamplePosition(). Is there any way to fix this (use the default area as areaMask and not get the whole NavMesh) without having to put NavMeshModifierVolume on the desirable areas? Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source