I like to keep my buildings all as one mesh (See picture).
What is the best way to mark (for example) the rooftops as not walkable?
The best way I have found is to put a scaled-up cube there, mark it not-walkable, bake the mesh, then hide the cube’s MeshRenderer.
This seems tedious… is there any way I can just leave ONLY the invisible collider up there as the blocker, not leave the MeshRenderer on during bake? I can always make a runtime mesh hider script and put it on there but this also seems like a hack.
Q: How to block areas from being walkable WITHOUT using a separate MeshRenderer?
Thanks Lurk for the pointer… that is what I want exactly.
BUT! I went down a deep and annoying rabbit hole for a while though because I could not get the volume to work.
I even created projects in 2020, 2018 and even Unity5, using the appropriate branch of the code in all cases.
In all cases it absolutely WOULD NOT cut a hole in my NavMesh. I baked and re-baked, double-triple-checked the static-ness, the visual overlap, the shape, the flags (Not Walkable) and everything.
It absolutely would NOT cut holes the way I wanted.
Turns out this external “Component workflow” stuff ONLY affects NavMeshSurfaces, which is one of the new components installed from github. Each instance of that stands up a fresh navigable surface, and THOSE pay attention to these volumes when baking.
I have suggested to Unity that they represent this clearly in bold at the top of the documentation.
I think maybe it is done at the agent level, which is a bit counter-intuitive. I think? You make a navmesh for each agent, then make your volume affect only one type of agent.
wouldn’t work for my use case then. I need to split regions of my map into multiple navmeshes because they are so big the NavMesh class just gives up and don’t give me an path otherwise, even if it does actually exists…