I have a package imported of a model which contains textures, materials, etc.
I have code that creates a new prefab containing only parts of these imported meshes, etc. It is a character customization tool so the import has all the combinations, and then my tool allows to select specific meshes to get the character by making a new prefab and cloning the GameObjects needed to make that particular design. I then export the GameObject to a prefab and also to an FBX using the FBX Exporter.
Inside the same project the new exported prefab and FBX seem to work fine, but when I attempt to use either them outside of the project in a different unity project or FBX tool they do not work because they have dependencies on the package assets in the original projects like the textures, meshes, etc. For example, I have a threejs webpage which the FBX can't load into because the textures are missing.
How can I export a GameObject (preferably in code but if not through Unity Editor) which has dependencies on an asset as a self-contained unit that can be used in other projects and (in the case of the FBX file) other tools?
I tried:
- Selecting the dependencies of the exported prefab and making a FBX Prefab Variant.
- Exporting to FBX directly using FBX Exporter using "Export To FBX..."
- Unpacking completely the original prefab before creating the new prefabs
- Using Export To Package (for the prefab) which I guess would work but is cumbersome
- Using the FBX Exported Unity SDK in code to export the FBX file
