There’s a bug in the FBX exporter for Blender 3.x (and now 4.x) that doesn’t export materials on instanced meshes. While the original mesh imports into Unity just fine (and remaps materials correctly under the importer’s Materials tab) duplicate instances of the same mesh import with only the default Lit material. If you’re (perhaps oldschool) like me, and use a lot of instancing to save disk space, this is a problem.
Here’s a Unity Editor script to fix things: FBXFixerScripts.zip
It supports Undo, regular and skinned meshes, and will walk down the hierarchy as far as it needs to. Can take a few seconds to grind through big hierarchies. Works on my ultra-complex Lighthouse prefab, and all the others I’ve thus far thrown at it. If you find a bug, let me know!
Here’s how to use it:
- Download & unzip the files.
- Add FixFBXImportMatsUI.cs to your project’s Editor folder. (If your project doesn’t currently have one, add a folder named “Editor” to your Assets folder.)
- Add FixFBXImportMats.cs to your project, wherever makes the most sense.
- After importing an FBX with missing Materials, open the Prefab or drag it into a Scene, and add a FixFBXImportMats Component to the root of the import’s hierarchy.
- Assign the Default Material you need replaced to the Component’s slot.
- The default Material will vary depending on your render pipeline and import settings.
- If using URP, it’s usually the Lit material, located in Packages: Universal RP: Runtime: Materials.
- A quick way to find it is the select an instanced mesh in the hierarchy, and click on the Material shown in the Editor.
- Leave Clean Up After checked to have the Component remove itself after running.
- Click Fix Materials.