mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-14 23:10:46 -05:00
use TryGetComponent
This commit is contained in:
@@ -133,11 +133,11 @@ namespace UniGLTF
|
||||
//
|
||||
Func<HumanBodyBones, Transform> getBoneTransform = null;
|
||||
|
||||
if (ExportRoot.GetComponent<UniHumanoid.Humanoid>() is UniHumanoid.Humanoid humanoid)
|
||||
if (ExportRoot.TryGetComponent<UniHumanoid.Humanoid>(out var humanoid))
|
||||
{
|
||||
getBoneTransform = humanoid.GetBoneTransform;
|
||||
}
|
||||
else if (ExportRoot.GetComponent<Animator>() is Animator animator && animator != null)
|
||||
else if (ExportRoot.TryGetComponent<Animator>(out var animator))
|
||||
{
|
||||
getBoneTransform = animator.GetBoneTransform;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user