Door Controller with NavMeshGraph

Prior to today I have been using a RecastGraph, but my scan times were getting rather high, so I decided to scan, then export to OBJ, and use the resulting mesh as a NavMeshGraph. The DoorController worked fine with the recastgraph, updating Opened and Closed tags properly, but seems to have no effect with the imported navmesh. Am I missing something? Also, I was testing for PointOnNavmesh with the recast graph, but that doesn’t seem to work with a normal navmesh either. I’m sure I must be missing something obvious here, and would be grateful for a push in the right direction. Thanks!


Not sure why the tags didn’t work. But there is a better solution for you. You can use cached startup to avoid the initial calculation cost.
Open the Save & Load tab and click the Generate Cache button, that will save the graph data and store it so that it doesn’t have to be calculated every time you start the game.

The navmesh graph is less developed than the recast graph. Ultimately I want to merge the two graph types because after the recast graph is scanned, it behaves exactly like a navmesh graph, so right now there is lots and lots of similar code that could be merged into a single class.

Thanks Aron, that worked out just perfectly! I guess the reason I didn’t try to include it sooner is that the astarpath inspector becomes very sluggish after caching. (only 17.5kb currently). Thanks again man. I have been bashing my head against the wall all day with this. lol.

Yeah, that’s something I need to fix. After Unity changed their Undo system, it apparently needs to go through all the stored data every frame, which does take a bit of time.
If it really annoys you, you can save it to a file and write a simple script to load it at start.

Cool I’ll try that if I really need to keep tweaking the inspector (which I really don’t since it’s pretty much dialed in now). Thanks again!