In OnPostprocessModel, I want to prepare a GameObject that is parented to another GameObject, and then create a prefab out of that. This works fine, but it leaves an instance in the scene. When I try to destroy the object after creating the prefab, the editor crashes. Here's the code:
I'm not convinced I'm heading down the right path. What's the correct way to create complex prefabs during asset postprocessing, involving the asset which is being imported?
asked Dec 06 '09 at 02:53 AM
The GameObject being passed to OnPostprocessModel is not an in-scene GameObject, but the one going into your assets. Trouble starts when you attach this GameObject to an in-scene GameObject.
What you should do is:
answered Dec 07 '09 at 11:12 AM