PlayFab / PlayFabMultiplayerUnreal

PlayFab Online Subsystem Plugin for Unreal Engine
https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/networking/party-unreal-engine-oss-overview
39 stars 35 forks source link

Update NetworkState in OnNetworkDestroyed instead of OnLeaveNetworkCompleted #67

Open bschatt opened 3 months ago

bschatt commented 3 months ago

When the player lose the connection to PlayFab the Network is destroyed automatically. Since we didn't call LeaveNetwork in this case, OnLeaveNetworkCompleted will not be called. This means that the NetworkState will not be updated and it will be impossible to join or create another network as you can see in the snippet below:

https://github.com/PlayFab/PlayFabMultiplayerUnreal/blob/3a65b088ded963cfe4fb1cd43391a171e80470b3/Source/Private/OnlineSubsystemPlayFab.cpp#L688 https://github.com/PlayFab/PlayFabMultiplayerUnreal/blob/3a65b088ded963cfe4fb1cd43391a171e80470b3/Source/Private/OnlineSubsystemPlayFab.cpp#L764

Updating the state in OnNetworkDestroyed instead handles both cases. As stated in the comment the PartyLeaveNetworkCompletedStateChange documentation clearly states that "an associated PartyNetworkDestroyedStateChange will be generated before this state change is generated." We have been able to confirm this behavior.