question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Programmatic build nav mesh uses previous build

See original GitHub issue

Hey 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: image

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): image

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 image

And the file NavMesh-NavMesh does actually exist: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
h8mancommented, Apr 7, 2021

@GitFlip

Nice idea about warning. Also I will update wiki. determine loop

UP note added

1reaction
h8mancommented, Mar 26, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update NavMesh at Runtime
The navmesh is used for "static" or unchanging objects. No movement, not being destroyed or added at runtime. If you want an object...
Read more >
Question to NavMesh in Version 2022+ : r/Unity3D
Currently i try to build a character controller using a nav mesh. all available usable youtube tutorials only cover the old navigation ...
Read more >
How to bake/update NavMesh at Runtime in Unity - YouTube
0:00 Intro 0:10 Awkwardly install the package 0:54 Add 2 cubes to test NavMeshes 1:20 Copy runtime baking code 2:00 Attach script to...
Read more >
How to Create and Use Dynamic Navmesh in Unity (Bake at ...
Hi ! Today I'll be showing you a unity package allowing us to bake navmesh during runtime aka Playmode.
Read more >
Creating a NavMesh Agent
Creating a NavMesh Agent. Once you have a NavMeshA mesh that Unity generates to approximate the walkable areas and obstacles in your environment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found