Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Issues with adding weapons to a character using Animation Rigging

Discussion in 'Animation Rigging' started by Arthur-A, Aug 15, 2020.

  1. Arthur-A

    Arthur-A

    Joined:
    Mar 17, 2018
    Posts:
    10
    Hello. Let me explain the issue I'm facing. I've imported a SWAT character from Mixamo with a bunch of animations, it has an Animator component with the controller and an avatar assigned to it. I've also added a weapon (AKM) as a child of my character.

    I've added a Rig Builder component to my character:
    Capture1.JPG
    Then, I've created a RigLayer Game Object and assigned a Rig component to it which is assigned to the Rig Builder:
    Capture2.JPG
    As a child of a RigLayer, I've added an object RightHandIK with a Two Bone IK Constraint component. I've added my characters Right Arm, Forearm and Hand for Root, Mid and Tip. As a target, I've temporarily added my AKM weapon's Transform - just to see how it roughly works:
    Capture3.JPG
    When I hit Play - my animations stopped working, character stays in the T-Pose and there are a bunch of errors in the Console:
    Capture4.JPG

    I've copied 3 main types of error messages, here they are:

    Code (CSharp):
    1. Transform 'WPN_AKM' not found in HumanDescription.
    2.  
    3. Could not resolve 'WPN_AKM/WPN_AKM' because the avatar is invalid. Please assign a valid Avatar or create one with AvatarBuilder.
    4.  
    5. InvalidOperationException: The TransformStreamHandle cannot be resolved.
    6. UnityEngine.Animations.TransformStreamHandle.CheckIsValidAndResolve (UnityEngine.Animations.AnimationStream& stream) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
    7. UnityEngine.Animations.TransformStreamHandle.SetLocalTRS (UnityEngine.Animations.AnimationStream stream, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, UnityEngine.Vector3 scale, System.Boolean useMask) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
    8. UnityEngine.Animations.Rigging.RigSyncSceneToStreamJob+TransformSyncer.Sync (UnityEngine.Animations.AnimationStream& stream) (at Library/PackageCache/com.unity.animation.rigging@0.3.4-preview/Runtime/AnimationJobs/RigSyncSceneToStreamJob.cs:49)
    9. UnityEngine.Animations.Rigging.RigSyncSceneToStreamJob.ProcessAnimation (UnityEngine.Animations.AnimationStream stream) (at Library/PackageCache/com.unity.animation.rigging@0.3.4-preview/Runtime/AnimationJobs/RigSyncSceneToStreamJob.cs:117)
    10. UnityEngine.Animations.ProcessAnimationJobStruct`1[T].Execute (T& data, System.IntPtr animationStreamPtr, System.IntPtr methodIndex, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
    11. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    When I separate the weapon from the character hierarchy - there are no errors and all animations and IK working, the weapon just floats in the air and character's right hand sticks to it.

    What I've also noticed is, when instead of a weapon, I've added a simple 3D object as a child of the character, there are no errors when I press Play. But when I add some children to that 3D object - I get the same error as shown above. So for some reason, it doesn't like when there's a complex object is a child of a character, so it's not that particular weapon that causes the issue.

    So, my question is, how do I properly add weapon to my character using Animation rigging? Any advice or hints would be appreciated!
     
  2. Arthur-A

    Arthur-A

    Joined:
    Mar 17, 2018
    Posts:
    10
    Phew, finally found the issue!
    I've played around with different weapon models from the Polygon Pack and they were working fine, while being inside the Player hierarchy. Upon closer inspection I found out that the problem of the AKM weapon was that the root object and one of it's children had the same name: "WPN_AKM":
    Capture1.JPG

    I've renamed the child object to "WPN_AKM_body" and it worked just fine!
    Capture2.JPG

    Apparently, when I was adding a 3D object (a cylinder) earlier, I was adding another cylinder as a child with the same name thus all those errors.

    Well, I hope any newbies like me who might face this issue will stumble across this thread and it'll save them hours of frustration:)
     
    kenmaready, eon95, FabdBrave and 20 others like this.
  3. rucesocial

    rucesocial

    Joined:
    Mar 13, 2020
    Posts:
    9
    Thanks!
     
  4. karthikeyuboosa

    karthikeyuboosa

    Joined:
    Dec 13, 2019
    Posts:
    2
    Thanks. It worked!
     
  5. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    450
    Geee! Thank you so much! If it weren't for you I would spend a lot more time figuring this out!
     
    Arthur-A likes this.
  6. MassimoFrancesco

    MassimoFrancesco

    Joined:
    Jul 6, 2019
    Posts:
    44
    I had the same error and found your thread in the search results.

    Thank you so much, it solved my issue too. I had a disabled but duplicated "Root" on the same hierarchy level, which caused this on my end. Apparently the system does not like child gameObjects with the same name at all.
     
  7. HEMANTH2410

    HEMANTH2410

    Joined:
    Dec 21, 2016
    Posts:
    4
    I am facing the same issue, I am using Polygon assets from Synty studios.
    No matter what changes i do, Animation rigging doesn't want me to attach this weapon
    Screenshot (59).png Screenshot (9).png Screenshot (59).png
     
  8. HEMANTH2410

    HEMANTH2410

    Joined:
    Dec 21, 2016
    Posts:
    4
    IK works when i remove Avatar from animator component
    Screenshot (62).png
     
  9. MichealJS98

    MichealJS98

    Joined:
    Dec 14, 2021
    Posts:
    1
    Thank you very much for your solution!!!
     
    Arthur-A likes this.
  10. anandhups1811

    anandhups1811

    Joined:
    May 23, 2021
    Posts:
    1
    Thanks a lot
     
    Arthur-A likes this.
  11. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    146

    Thank you! When I found out this error had something to do with animation rigging I found your post and than fixed the naming.
    You would expect a proper error message.....
     
    Arthur-A likes this.
  12. kenmaready

    kenmaready

    Joined:
    Mar 31, 2023
    Posts:
    2
    Thank you!!!!