Remote Player (Networked Instance) not re equipping weapon.

Hello Ive encountered a bug which will cause the networked character to not equip his weapon upon respawn.

1. Character controller variant (Ultimate Character Controller, First Person Controller, etc). -> Ultimate Character Controller Pun Addon
2. Unity version (include which SRP, beta Unity versions aren't supported) -> 2021.3.22f1 on MacOSX with Apple Silicone

3. Bug description:
If at spawn I will equip a weapon like so:
C#:
public void GetSavedWeaponAndEquip()
    {
        PlayFabClientAPI.GetUserData(new GetUserDataRequest(), result =>
        {
            if (result.Data != null && result.Data.ContainsKey("AceWeapons"))
            {
                string savedWeapon = result.Data["AceWeapons"].Value;
                EquipWeapon(savedWeapon);
            }


        },
        error =>
        {
            Debug.LogError("Failed to get saved weapon from PlayFab: " + error.ErrorMessage);
        });
    }

Then on respawn the player normally respawns with the weapon but the networked player on the other device won't hold the weapon but stand in the animated pose as if he were holding it

4. Steps to reproduce
See 3.

5. The full error message (if any)
None

There is a very easy fix to this just remove the weapon on death and call GetSavedWeaponAndEquip on respawn, works perfectly fine. Still I believe this is a bug since it desyncs the game state. But maybe I also handle the weapon equip at start incorrectly.

Also since this is relevant can the DefaultLoadout be set via API at first spawn because I couldn't find the function for that?
 
What is EquipWeapon doing? Does PunCharacter.EquipUnequipItemRPC get called?

Also since this is relevant can the DefaultLoadout be set via API at first spawn because I couldn't find the function for that?
Inventory.LoadDefaultLoadout will load the items in the default loadout.
 
Hi so it does get called as per the screenshots:

LocalClient.jpgRemoteClient.png

Also regarding "Inventory.LoadDefaultLoadout" my question was if the default load out can be set at runtime or if it can only be set in editor ?
 
Top