From ca0e062e9c2f231487be931166c918ff20ad1e55 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 24 Jul 2024 20:18:44 +0900 Subject: [PATCH] use TryGetComponent --- Assets/UniGLTF/Editor/UniGLTF/Validation/HumanoidValidator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/Editor/UniGLTF/Validation/HumanoidValidator.cs b/Assets/UniGLTF/Editor/UniGLTF/Validation/HumanoidValidator.cs index f95a3b422..2f65878d0 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/Validation/HumanoidValidator.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/Validation/HumanoidValidator.cs @@ -133,11 +133,11 @@ namespace UniGLTF // Func getBoneTransform = null; - if (ExportRoot.GetComponent() is UniHumanoid.Humanoid humanoid) + if (ExportRoot.TryGetComponent(out var humanoid)) { getBoneTransform = humanoid.GetBoneTransform; } - else if (ExportRoot.GetComponent() is Animator animator && animator != null) + else if (ExportRoot.TryGetComponent(out var animator)) { getBoneTransform = animator.GetBoneTransform;