- Home /
Saving generated meshes at runtime in game
Hello,
I want to save meshes created by users of my app (at runtime, in game) that are imported from .OBJ files. I have .OBJ importer for the meshes and the meshes are imported, but when users close the app, the meshes are lost and they must be imported to the app again. So my question is:
Is it possible to save such generated at runtime meshes in game (NOT IN UNITY EDITOR!)?
I know that
AssetDatabase.CreateAsset(meshToSave, path);
AssetDatabase.SaveAssets();
works in Editor only. What to do in game?
Hey, did you ever get this figured out? Trying to do a similar thing myself!
Answer by Bunny83 · May 31, 2018 at 10:21 PM
I've once created a mesh serializer for Unity. It serializes a Mesh to a compact custom binary format. It should support any kind of Mesh Unity supports. Which includes blendshapes. Since animations aren't bound to a particular mesh it doesn't support animations but it does support skinned meshes so it does serialize the skinning information if present.
Answer by Tobychappell · May 31, 2018 at 10:01 PM
Save everything about the game object that can/needs to be serialized to a data file. Then load and build the mesh from that data.
Your answer
Follow this Question
Related Questions
Converting 2d sprite to mesh - looking better algorithm 1 Answer
Importing .obj from Maya - mesh invariably called "default" 2 Answers
Why does this script put Unity into a not responding state? 0 Answers
Prevent seams on a generated mesh with split edges. 0 Answers
Normal maps not applying to certain faces of a mesh 2 Answers