Item animator parameters not set on client

ChristianWiele

Active member
Hi,

I have an item (paddle) with an animator. On the server the animator parameters are set correctly, but on the client they are not set so the animation is not playing. The animator parameters for the character are set correctly. What is possibly going wrong?

Thanks, Christian
 
It sounds like the PunAnimatorMonitor isn't syncing all of your slots - I would start debugging within the SetItemIDParameter of that class.
 
I found the issue. The PunAnimatorMonitor correctly transfers the animator parameters, but they are never set on the item animator. The reason is that the m_EquippedItems array is always empty on the remote system (IsLocalPlayer = false), because the OnAbilityWillEquipItem event of the EquipUnequip ability is never fired. Thus the OnWillEquipItem method in the AnimatorMonitor is never called where the m_EquippedItems array is populated.

You can also check this in the demo scene. The string of the BowPun is not animated on the client.
 
Hmm, ok, thanks for debugging. I will add this to my list of things to fix in the next update which should be soon.
 
I had a chance to take a closer look at this. You should be able to fix it by applying the change below. Make sure you include the Opsive.UltimateCharacterController.Items namespace.

From:
Code:
            if (equip) {
                if (m_Inventory.GetActiveItem(slotID) != item) {
                    m_Inventory.EquipItem(itemIdentifier, slotID, true);
                }
            } else {
                m_Inventory.UnequipItem(itemIdentifier, slotID);
            }
to:
Code:
            if (equip) {
                if (m_Inventory.GetActiveItem(slotID) != item) {
                    EventHandler.ExecuteEvent<Item, int>(m_GameObject, "OnAbilityWillEquipItem", item, slotID);
                    m_Inventory.EquipItem(itemIdentifier, slotID, true);
                }
            } else {
                EventHandler.ExecuteEvent<Item, int>(m_GameObject, "OnAbilityUnequipItemComplete", item, slotID);
                m_Inventory.UnequipItem(itemIdentifier, slotID);
            }
 
Top