diff --git a/Assets/UniGLTF/Editor/Animation/AnimationValidator.cs b/Assets/UniGLTF/Editor/Animation/AnimationValidator.cs index 91812a93d..f44def57d 100644 --- a/Assets/UniGLTF/Editor/Animation/AnimationValidator.cs +++ b/Assets/UniGLTF/Editor/Animation/AnimationValidator.cs @@ -23,13 +23,11 @@ namespace UniGLTF } var animationClips = new List(); - var animator = root.GetComponent(); - var animation = root.GetComponent(); - if (animator != null) + if (root.TryGetComponent(out var animator)) { animationClips = AnimationExporter.GetAnimationClips(animator); } - else if (animation != null) + if (root.TryGetComponent(out var animation)) { animationClips = AnimationExporter.GetAnimationClips(animation); }