Skip to content

Commit 593c66b

Browse files
committed
Fixed bug
1 parent 168eb78 commit 593c66b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,24 @@ protected bool ExportInstance (GameObject unityGo, FbxNode fbxNode, FbxScene fbx
12601260
return true;
12611261
}
12621262
}
1263+
else
1264+
{
1265+
// We don't export the mesh because we already have it from the parent, but we still need to assign the material
1266+
var renderer = unityGo.GetComponent<Renderer>();
1267+
var materials = renderer ? renderer.sharedMaterials : null;
1268+
1269+
Unity.FbxSdk.FbxSurfaceMaterial newMaterial = null;
1270+
if (materials != null)
1271+
{
1272+
foreach (var mat in materials) {
1273+
if (MaterialMap.TryGetValue(mat.name, out newMaterial));
1274+
{
1275+
fbxNode.AddMaterial(newMaterial);
1276+
}
1277+
}
1278+
}
1279+
}
1280+
12631281

12641282
if (fbxMesh == null) return false;
12651283

0 commit comments

Comments
 (0)