Best way to serialize a Mesh and/or Material in Runtime?
What would be the best way to save a mesh + material to a file while beeing in the game (not in editor mode) to load it later again as fast as possible into memory? Idealy I am looking for something like http://docs.unity3d.com/ScriptReference/AssetDatabase.CreateAsset.html which is available not only in the editor ;)
I think a binary serialization logic would be fastest to load again, any suggestions or tips where I should start looking?
I'm searching for something similar. Sadly AssetDatabase.CreateAsset needs UnityEditor and if I want to serialize a $$anonymous$$esh it fails because a $$anonymous$$esh hasn't a [SerializeField].
Did you found a solution or a way to save a $$anonymous$$esh without using UnityEditor?
Answer by Statement · Feb 16, 2016 at 03:06 PM
Regarding best way, well, I don't really know what is best for you. Different platforms have different read/write speeds and different CPU/memory speeds. Compression may help, but a slow compressor/decompressor might backfire. Start out with a flat binary file where you just dump the contents out and read them back in. If it's too slow, profile your serialization code and try to figure out if compression could help. If you're dealing with lots and lots of files, consider trying to spread work over multiple cores - although that too can backfire with context switches for harddrives etc.
My advice is to try some different options.