Lukas - CryoCorp
New member
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:
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?
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?