- Home /
missing mesh after creating prefab inside AssetPostprocessor . OnPostprocessModel ()
hey guys, I have a skinned mesh FBX file and I want to create a prefab of it on import . Doing it in AssetPostprocessor.OnPostprocessModel() seems to almost work, except the mesh inside the SkinnedMeshRenderer component that is null.
I have tried to force reconnect the Mesh object after PrefabUtility.CreatePrefab() and it results in 'missing (Mesh)' but still it is not there. Odd part is that if I pause execution with a break point right after reconnecting the sharedMesh with :
SkinnedMeshRenderer tempMeshRenderer = prefab.GetComponentInChildren(); tempMeshRenderer.sharedMesh = mesh ;
it's set correctly until the AssetPostprocessor finishes and then its missing.
What's going on here? Thank you
I have the same problem too in editor. When i create the prefab all the meshes in the render component go missing.
Answer by Issam · Feb 24, 2016 at 05:49 PM
You need to create your prefab in OnPostprocessAllAssets(...), before that the game object you are manipulating is temporary. More info here: http://answers.unity3d.com/questions/996952/after-assetpostprocessor-meshes-seem-to-be-gone.html
(I added a reply to that answer i linked, not sure when it will appear)
Your answer
Follow this Question
Related Questions
Create a Prefab from imported Assets automatically 0 Answers
is it possible to have a global/static variable in the AssetPostprocessor script 1 Answer
AssetPostprocessor - Can't change Mesh Data 2 Answers
Reimported fbx isn't updating new objects 0 Answers
How do I mark an asset as processed in AssetPostprocessor class 0 Answers