Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Animator.GetBoneTransform returning null from 2018.3.0b3 on?

Discussion in '2018.3 Beta' started by xVergilx, Oct 4, 2018.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    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.
     
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,127
  3. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    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
    Code (CSharp):
    1.  
    2. if(animator.avatar == null)
    3. {
    4. Debug.Log("Null avatar");
    5. }
    6. else if(!animator.avatar.isValid)
    7. {
    8. Debug.Log("Invalid avatar");
    9. }
    10. else if(!animator.avatar.isHuman)
    11. {
    12. Debug.Log("GetBoneTransform cannot be used on a generic avatar");
    13. }
    But like @LeonhardP said you should log a bug because that seem unexpected and probably hide another issue.
     
    xVergilx likes this.
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Seems like my avatar didn't re-imported properly. I've received:
    Rig page shows the following error:
    rigerror.PNG

    Not quite sure why it got this weird error though. There's definitely a transform with that name:
    fb2_hierarchy.PNG

    As well as it's definitely set as humanoid.
     
  5. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    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.
     
    VirtualSUN and hippocoder like this.