Animator.GetBoneTransform returning null from 2018.3.0b3 on?

This might be not related to bugs at all, but after I’ve upgraded 2018.3.0b2 → 2018.3.0b3 seems like it’s no longer returning any bones. Also, I’ve upgraded to 2018.3.0b4 and it’s the same result.

I’ve also lost some of the prefab references, can this be a cause of this? If so, can someone point me where to assign those?

Or, it’s because of the changes to the model importer? Some help would be appreciated.

Could you please submit a bug report with a minimal reproduction project for this issue and reply in here with the issue ID?

Regarding the lost prefab references, that issue should be fixed in b5.

Hi @VergilUa ,

We do have a bunch of unit test covering this function and they all succeeded for thoses releases

One reasons for GetBoneTransform returning null would be if the animator.avatar is null or if the avatar is not configured as a humanoid correctly.

you can validate this by doing something like this

if(animator.avatar == null)
{
Debug.Log("Null avatar");
}
else if(!animator.avatar.isValid)
{
Debug.Log("Invalid avatar");
}
else if(!animator.avatar.isHuman)
{
Debug.Log("GetBoneTransform cannot be used on a generic avatar");
}

But like @LeonhardP said you should log a bug because that seem unexpected and probably hide another issue.

1 Like

Seems like my avatar didn’t re-imported properly. I’ve received:

Rig page shows the following error:
3755614--312838--rigerror.PNG

Not quite sure why it got this weird error though. There’s definitely a transform with that name:
Hierarchy 3755614--312844--fb2_hierarchy.PNG

As well as it’s definitely set as humanoid.

Okay, so it turns out that changing mode to none, then restarting Unity, and changing back to humanoid on the avatar re-imports it without an error.

Also, once I got rid of the error, it generated “almost” an avatar. It passed code checks above without any issues, however, bones were still returning as null.

What I did was to open the avatar and pressed “Done” button, and it saved it.
After that, GetBoneTransform found the bones correctly.

From now on I’m pretty sure ModelImporter is messed up.

2 Likes