Am not sure if anyone realized or already asked this question on the forums.
So , new dynamic navmesh generation, BUT no saving / loading navmesh data?
Lol?
Am not sure if anyone realized or already asked this question on the forums.
So , new dynamic navmesh generation, BUT no saving / loading navmesh data?
Lol?
You can grab the navmesh vertices/triangles through NavMesh.CalculateTriangulation() and output any format you’d like. Theoretically, you can load by importing the file, converting to a mesh, and then building it but I’m having no luck doing that.
Having actually the same problem.
I would definitely need a load/save function as I have a tile base system (up to 10k tiles) with an ingame edtior. which takes 15-20 seconds to generate on a quite fast machine. Users will not wait for so long to load a level.
Any help would be greatly appreciated!
+1 really need a solution to this
There is no way to inject this data back into the navmesh, so this is not going to work. I created a mesh out of this triangulation data, but I would need to bake it again, which doesn’t help at all.
We need some more functions exposed to make this work or a save/load function for the navmesh. If this is not going to be solved soon, I will kick the Unity navigation completely and try a different solution.
@Jakob_Unity it would be great if you could give a comment, if this is on the roadmap in the near future. Cheers.
I will look into this - but currently busy working on much requested async query API.
Thanks! ![]()
Any news yet?
no - only thoughts so far. We might add a special serialize/deserialize API for navmesh - e.g. between NavMeshData and byte array.
Thanks for the update. Adding a serialize/deserialize API to the navmesh would be perfect!
That would indeed fix the issue - be sure to also include the build source cache and other useful stuff needed so that we can run the lightning fast UpdateNavMeshData on it just as if it was backed in the same session.
In my scenario on a 2048x2048 terrain it takes upwards of a minute to generate the initial mesh. Later UpdateNavMeshDataAsync calls are instant so kudos on that!
Now I just need a way to save the navmesh once generated and just update it as new stuff (buildings) etc are created.
Any progress on this?
Ya this is kind of a major oversight in the api. You can create instances of navmeshdata and store/load those, but you can’t obtain an instance of it from the navmesh. Providing serialization kind of misses the major point which is we can’t even get at the object itself right now if it was created via the normal build process.
So you can get partway there now.
First create your navmesh using the builder, not the editor flow. Otherwise updating takes a long time since the editor uses different settings.
Then create a component (ScriptableObject will not work) with a NavMeshData field in your scene and then use AssetDatabase.CreateAsset to save the navmeshdata That links the field to the asset and now it persists in the scene. Now you load it via NavMesh.AddNavMeshData.
That at least lets you start with a base navmesh already there that you can also update.
Actually you don’t need to save it as an asset. I was trying to use that to make ScriptableObject work which didn’t, but I just went back and tried it with the component route and not creating an asset, and it persists fine.
@Jakob_Unity Can we please get an update on this?
Everything works fine in the editor using AssetDatabase, but this doesn’t work in builds of course.
Any update on the serialization possibilities?
This is a big hole in the pipeline for those who don’t use scenes to manage content.
Maybe I am oversimplifying this in my head, but surely Unity is already serializing the navmesh for a scene into the NavMesh.asset file, and then de-serializing it when the scene is loaded. How far removed could we possibly be from saving a runtime generated navmesh into a .asset file and then loading it on demand?
It feels like the navmesh system was 90% implemented and abandoned a few steps before the finish line. We switched over to runtime navmesh generation in Unity 5.6 with the promise of runtime navmesh jump generation “coming soon”. Now it’s a year later and here we are still manually placing jumps.
100%. The Navmesh system has felt incomplete ever since it’s initial release, and it’s very frustrating. But we get graphics updates cause that’s what looks good on the advertisements
Can you please give an update on this? It takes multiple minutes for me to generate a navmesh using the runtime generation. I have a large open world game with lots of dynamically placed trees and so on. Forcing users to wait that long each startup is not an acceptable solution for me.