[Edit: I posted this on the wrong forum. I created another thread under graphics (which i guess is more adapted).]
Wanting to create a metroidvania platformer, I thought i might first create a map editor to have a nicer workflow. I started using sprites, but then i decided to learn how to create meshes. Thing is, it is exceptionally more complex and i don’t understand everything.
It is map editor working at runtime that consists in creating meshes using points and triangulation with automatic UV mapping, creation of edges colliders according to the points. Then hitting save, it will have to create a file ( using binaryformatter/json/xml, i’m not sure yet ) holding all the infos of each mesh, the infos about edges colliders. (i don’t use mesh colliders).
After that, in another Scene, i need to read all the data of the created level and create again those meshes during runtime. Thing is, i need those meshes to load smoothly, as i will need to load the level 2 as the player is approaching it without loading screen (and without loosing too much framerate).
One level contains something like 200 meshes, each mesh having around 18 vertices. They all use shared materials, with something like 30 different materials ( mostly 64x64 pixels textures set to repeat).
How should I save all those meshes as one file on the HardDrive? Should I just save the vertices and UV? Should i store everything from them, vertices, uv, triangles, normals ( maybe there are other things to store i’m not sure).
Is a serialized class saved as a file using binaryformatter the best way of doing it?
How should I load them nicely after that ?
Before, i was using object pooling and was setting sprites at the right location one by one every frame using a list of Vector3 stored on such a file. Can i do such a thing with meshes?
Is creating lot of meshes at the start of the game, then modifying their position/vertices/uv/materials during runtime one by one every frame / in a coroutine an efficient way of doing it?
Is the Mesh.MarkDynamic adapted for such an use? (I’m not 100% sure of what it does).
I started creating this editor a few weeks ago, reading during my breaks everything i could find about mesh generations , but I wasn’t able to understand / find things looking like what I need.
Thanks a lot for reading my long post, I hope i acheived to explain myself correctly.
https://forum.unity.com/threads/generating-saving-loading-meshes-at-runtime.498743/