Error exporting FBX of multiple selected GameObjects

Hi, I’m trying to export a lot of GameObjects as FBX files at their lowest level of detail. If I select all the objects and attempt to export them I get the following error:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Formats.Fbx.Exporter.ModelExporter.ExportTransformHierarchy (UnityEngine.GameObject unityGo, Autodesk.Fbx.FbxScene fbxScene, Autodesk.Fbx.FbxNode fbxNodeParent, System.Int32 exportProgress, System.Int32 objectCount, UnityEngine.Vector3 newCenter, UnityEditor.Formats.Fbx.Exporter.ModelExporter+TransformExportType exportType, UnityEditor.Formats.Fbx.Exporter.ExportSettings+LODExportType lodExportType) (at Library/PackageCache/com.unity.formats.fbx@4.1.2/Editor/FbxExporter.cs:2896)
UnityEditor.Formats.Fbx.Exporter.ModelExporter.ExportAll (System.Collections.Generic.IEnumerable1[T] unityExportSet, System.Collections.Generic.Dictionary2[TKey,TValue] exportData) (at Library/PackageCache/com.unity.formats.fbx@4.1.2/Editor/FbxExporter.cs:3739)
UnityEditor.Formats.Fbx.Exporter.ModelExporter.ExportObjects (System.String filePath, UnityEngine.Object[ ] objects, UnityEditor.Formats.Fbx.Exporter.IExportOptions exportOptions, System.Collections.Generic.Dictionary`2[TKey,TValue] exportData) (at Library/PackageCache/com.unity.formats.fbx@4.1.2/Editor/FbxExporter.cs:4607)
UnityEditor.Formats.Fbx.Exporter.ModelExporter.OnExport () (at Library/PackageCache/com.unity.formats.fbx@4.1.2/Editor/FbxExporter.cs:4533)
UnityEditor.Formats.Fbx.Exporter.ModelExporter.OnContextItem (UnityEditor.MenuCommand command) (at Library/PackageCache/com.unity.formats.fbx@4.1.2/Editor/FbxExporter.cs:4048)

I do not get this error if I export objects one at a time or if I export all selected objects at all levels of detail instead of lowest or highest.

Hi! is it possible that one of your LODs has a missing renderer in the LOD group?8403102--1109577--upload_2022-8-30_14-45-25.png

I’ll log a bug to add a null check and catch this exception.

That was it! Thank you!

1 Like