- Home /
AssetDatabase.AddObjectToAsset is not persistent?
I am using OnPostprocessModel to generate some new meshes and add them to an existing asset. I use the following line to do so:
AssetDatabase.AddObjectToAsset (filter.sharedMesh, assetPath);
filter is a mesh filter generated in OnPostprocessModel and sharedMesh is the mesh to be saved.
The mesh is saved and everything works fine. However, when I close the Unity Editor and then return, the mesh is gone and all GameObjects that referenced it now have their mesh set to null. Is this a bug or am I missing something?
Your answer
Follow this Question
Related Questions
Find Asset from Mesh 1 Answer
can you make a prefab but without a model? 3 Answers
duplicate a prefab then change the model? 1 Answer
Editor Script Get mesh from imported model? 0 Answers
Fastest Way To Save/Load a SkinnedMeshRenderer at Runtime 0 Answers