- Home /
How to load NavMesh from streaming assets at runtime
I'm working on a simulation which allows users to specify an arbitrary GPS position (which loads the location terrain using Mapbox) to create "levels". I use NavMeshComponents github repo to create the NavMesh data at runtime from their terrain. I would like to allow users to save this data and then load it later when they load their "level".
I'm currently using AssetDatabase.CreateAsset()
to save the NavMesh data. I save the data to the Resources folder and use Resources.Load()
to load it. However this requires the Editor, I can't use that in a build. I saw information about streaming assets but the examples I saw used WWW to read in the data, and WWW seems like it can only handle certain data types (texture, audio, etc).
How can I save and load an asset like NavMesh data? If I save it using C# File I/O, I'm not sure how I would load it. Using Resources.Load() is easy since I can just do Resources.Load(filename) as NavMeshData
. Any suggestions on how I can do this? Any help is appreciated!