- Home /
Why Animator.GetBoneTransform returns null
Hello,
I have an animator with configured humanoid avatar.
I'm trying to get position of hand with
Animator thisAnimator = GetComponent<Animator> ();
Transform temp = thisAnimator.GetBoneTransform (HumanBodyBones.RightHand);
Debug.Log (temp);
It always returns null. I checked it with other bones but result is the same.
Answer by Elkeins · Jun 14, 2017 at 02:36 AM
Did you check "Optimize Game Objects" on the model? If so you need to expose to bone you want to use this on.
Thank you. It works! So it seems better to leave it off during the development process.
I did not understand this answer. Can someone explain/paraphrase?
What do you mean by saying?
expose to bone you want to use on
Answer by flopes_ · Jun 29, 2021 at 07:45 AM
There is a collapsed field called "Extra Transforms To Expose" in the Rig Import settings check the ones you want to use, and should work fine.
Your answer
![](https://koobas.hobune.stream/wayback/20220612122032im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Manipulate bone transforms between animator layers? 0 Answers
Remove bone from animator/rig 0 Answers
2D Animation does not start 1 Answer
Can't manually rotate bones in inspector or through script. 2 Answers