Search Issue Tracker
Won't Fix
Votes
1
Found in [Package]
4.2.0
5.0.0-pre.1
Issue ID
FBX-437
Regression
No
FBX Exporter throws a KeyNotFoundException when exporting a high-polygon mesh
Reproduction steps:
- Open the attached “TempFBXExportRepro” project
- Open the “SampleScene” scene
- In the Hierarchy right-click on “DoesNotExport” GameObject
- In the context menu select “Export To FBX…”
Expected result: No errors in the Console
Actual result: Export is unsuccessful, error in the Console
Reproducible with: 4.2.0, 5.0.0-pre.1 (2020.3.42f1, 2021.3.15f1, 2022.1.24f1, 2022.2.1f1, 2023.1.0a22)
Reproduced on: Windows 10
Part of the error:
KeyNotFoundException: The given key '(NaN, NaN, NaN)' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <d6232873609549b8a045fa15811a5bd3>:0)
UnityEditor.Formats.Fbx.Exporter.ModelExporter.ExportMesh (UnityEditor.Formats.Fbx.Exporter.ModelExporter+MeshInfo meshInfo, Autodesk.Fbx.FbxNode fbxNode) (at Library/PackageCache/com.unity.formats.fbx@4.1.2/Editor/FbxExporter.cs:892)
Comments (2)
-
danielpatyk
Jul 15, 2025 11:24
Is it a problem to apply the mentioned fix from the comments?
-
rachid_bouemama
Feb 16, 2025 08:41
#look for this method
bool ExportMesh(MeshInfo meshInfo, FbxNode fbxNode)
{
...
#inside this loop
foreach (int val in vertOrder)
{
int polyVert = indices[polySize * f + val];#Add this :
// Check for NaN values before attempting to access the dictionary
if (float.IsNaN(meshInfo.Vertices[polyVert].x) || float.IsNaN(meshInfo.Vertices[polyVert].y) || float.IsNaN(meshInfo.Vertices[polyVert].z))
{
continue; // Skip this iteration if NaN is found
}
#End Fix
#rest code..
unmergedPolygons.Add(polyVert);polyVert = ControlPointToIndex[meshInfo.Vertices[polyVert]];
fbxMesh.AddPolygon(polyVert);
...
}}
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Unity CIL Linker fails on Player build when persistent listeners have "<" and ">" in their XML attribute names
- ”Lighting data asset ‘LightingData’ is incompatible with the current Unity version…” warnings are thrown when saving Indoors (URP) and Outdoors (URP) Scenes as Scene Templates
- [iOS] The screen blinks when transitioning from custom to Unity splash screen
- [macOS] ”Ignoring depth surface load action as it is memoryless” warnings are thrown when taking Game View Snapshot
- UI Builder Inspector scrolls back up when changes on an expanded but not fully displayed Inspector tab are saved
Resolution Note:
Closing this bug as first it is very old and unlikely to still be a problem.
Also, looking at the code, this looks like a faulty input mesh asset that contains NaN values.