Programmatic build nav mesh uses previous build
See original GitHub issueHey again @h8man!
Running into another issue and probably doing something wrong, but wanted to see if you’ve seen this scenario:
We’ve been randomly generating our tilemap and then programmatically calling the NavMeshSurface2d.BuildNavMesh()
using a custom GUI Editor button on our component that generates the level and builds the NavMesh. We had some issues at first, but as you may recall in #41 we were able to resolve them.
Now that we’re happy with our random level generation, we’d like to do it at the start of the scene when playing. Our level generation works and the BuildNavMesh()
sort of works. It builds the nav mesh, but it doesn’t use the same NavMesh data file, and for some reason though the NavMesh that is applied is the one that was last generated programmatically via our custom GUI Button.
I suppose the important thing to keep in mind is that whether or not you press the our GUI button to generate the level or start the scene to generate the level, the same exact code is being called.
Here are some screenshots - hoping you my have some suggestions on where to start investigating:
Pressing our Custom GUI Generate Level button works as intended:
After pressing Play a new level generates, but it using the previous generated NavMesh (notice the Nav Mesh Data is just called NavMesh
now though):
After stopping the scene, our tilemap will revert to the last level we had generated outside of play mode (this is normal) and of course it’s Nav Mesh Data is back to NavMesh-NavMesh
And the file NavMesh-NavMesh
does actually exist:
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (9 by maintainers)
@GitFlip
Nice idea about warning. Also I will update wiki. determine loop
UP note added
Hello, @GitFlip
I have seen the message, I just didn’t have time to open unity and look what is happening. It pretty straight forward to reproduce. I will come back to this shortly