Multi pathfinding???

Hello,
I developed a huge 3D city that has several buildings with several floors and several offices on each floor of each building. In order for me to set up the Pathfinding and Navigation system in my game, it turns out I have to make all my walls and floors as ‘static objects’ before clicking on “Bake” and make all my objects enabled. If I do this, I have to shut down Unity and rerun Unity because everything will then function at about 1 frame per minute (because of so many objects enabled all at the same time).

So far, I have my game set up to where if my camera is within a certain 3D cubical space (inside a 3D building), only that single floor gets rendered (whatever ‘floor’ the camera is on in whichever building). My object, (called ‘Inner’, which is what the inside of the building should look like on a floor-level basis) virtually enables itself and positions itself to where it LOOKS as if you are standing inside that building and on that particular floor). I also have an ‘upper floor’ and ‘lower floor’ render as well (which are also child objects of ‘Inner’) which is a copy of the ‘current floor’ which is also a child object of ‘Inner’. The ‘current floor’ object is the current floor that the camera is on. As the camera ascends and descends floors, everything LOOKS the same because ‘upper floor’ and ‘lower floor’ are both copies of ‘current floor’ so it LOOKS like you are switching floors because the camera can not see what is actually happening outside of the building (with ‘Inner’ moving up or down 1 unit). IF I had each floor in every building set up even as disabled instantiated objects, it takes me about 5 to 10 minutes to do a single operation in Unity (as it often causes Unity to crash). That is how big my city is.

If the camera is outside of all buildings, my object ‘Inner’ disables itself and only the outsides of all the buildings get rendered. This is a good practical solution for gaining a faster rendering system for huge cities like mine, but what about for pathfinding? What if I would like to duplicate a certain ‘area’ in my game, make copies of the baked path(s) IN that area and duplicate them to multiple areas (for the multiple floors in my buildings), that if my character is on a different floor from the NavMesh, the NavMesh agent will take the stairs (that link up and connect evenly to each and every ‘floor’)? Thank you for any tips.

Sincerely,
Michael S. Lowe

Unity has OCCLUSION. Do you have that enabled? Because it really sounds like you aren’t using it.

Enable occlusion, bake occlusion (should take very short amount of time), and engine will cull off invisible geometry.

Judging by my past experiences with unity navagent, I would attempt to get occlusion to work, and kept every single floor geometry (walls/ceiling/floor) loaded and maybe only dynamically spawn contents of those floors.

Also, you could first bake navigation, and then disable floors after baking is done. Navigation data will stay even after that.

If you want anything more complicated than that, you’ll need your own navigation system. There IS dynamic loading of navigation areas, but I haven’t used that and I highly doubt that it will be possible to make it work for multiple floors when floors aren’t loaded.

I also advise to investigate your bottleneck in unity profiler instead of assuming that “it is slow because there are too many objects”.

How do I enable occlusion, and what is occlusion? Also, how do I load and save navigation areas?