Hi,
I have written an importer to read a 3D model format that Unity does not support. I am able to load the model into the scene however I would like to then be able to save the model as a prefab, because the model is built procedurally created meshes/textures etc I can not do this. How can I save this gameobject and its children to a prefab structure for use in Unity?
This is what I am trying at the moment.
-Use AssetDatabase.CreateAsset on the root GameObject
-Use EditorUtility.CollectDeepHierarchy on the root
-Iterate through the found dependencies calling AssetDatabase.AddObjectToAsset on them.
I have found that this saves the structure however the Meshes, Materials and Textures are not being saved.
I found that I can add materials to the asset if I search for them however the Mesh object will not save for me if I do the same nor will the textures.
Can someone offer advice on how to save the Meshes and Textures(do I need to encode them to png?)
Should I use PrefabUtility.CreatePrefab instead?
Thanks
Karl