From 2ecd11cbe876cf46d9996bce6de45d2f2930a27b Mon Sep 17 00:00:00 2001 From: Felix Herbst Date: Sat, 3 Oct 2020 00:22:26 +0200 Subject: [PATCH] fix PR #2 --- .../Assets/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/UnityGLTF/Assets/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs b/UnityGLTF/Assets/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs index 344ad5efb..8748e1ce9 100644 --- a/UnityGLTF/Assets/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs +++ b/UnityGLTF/Assets/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs @@ -714,10 +714,11 @@ private CameraId ExportCamera(Camera unityCamera) private static bool ContainsValidRenderer(GameObject gameObject) { - var meshRender = gameObject.GetComponent(); + if(!gameObject) return false; + var meshRenderer = gameObject.GetComponent(); var meshFilter = gameObject.GetComponent(); var skinnedMeshRender = gameObject.GetComponent(); - return (meshFilter != null && meshRender != null && meshRender.enabled) || (skinnedMeshRender != null && skinnedMeshRender.enabled); + return (meshFilter && meshRenderer && meshRenderer.enabled) || (skinnedMeshRender && skinnedMeshRender.enabled); } private void FilterPrimitives(Transform transform, out GameObject[] primitives, out GameObject[] nonPrimitives)