Issues with adding weapons to a character using Animation Rigging

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:


Then, I’ve created a RigLayer Game Object and assigned a Rig component to it which is assigned to the Rig Builder:

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:

When I hit Play - my animations stopped working, character stays in the T-Pose and there are a bunch of errors in the Console:

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

Transform 'WPN_AKM' not found in HumanDescription.

Could not resolve 'WPN_AKM/WPN_AKM' because the avatar is invalid. Please assign a valid Avatar or create one with AvatarBuilder.

InvalidOperationException: The TransformStreamHandle cannot be resolved.
UnityEngine.Animations.TransformStreamHandle.CheckIsValidAndResolve (UnityEngine.Animations.AnimationStream& stream) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
UnityEngine.Animations.TransformStreamHandle.SetLocalTRS (UnityEngine.Animations.AnimationStream stream, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, UnityEngine.Vector3 scale, System.Boolean useMask) (at <947776085c2a45bebc6afa3092a3f6ed>:0)
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)
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)
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)
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!

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”:
6206277--681555--Capture1.JPG

I’ve renamed the child object to “WPN_AKM_body” and it worked just fine!
6206277--681558--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:)

25 Likes

Thanks!

Thanks. It worked!

Geee! Thank you so much! If it weren’t for you I would spend a lot more time figuring this out!

1 Like

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.

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

IK works when i remove Avatar from animator component

Thank you very much for your solution!!!

1 Like

Thanks a lot

1 Like

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…

1 Like

Thank you!!!

Thank you! Life-saving discorvery!

I really can’t thank you enough! It was very frustating.