question

Evan Maxey avatar image
Evan Maxey asked

PlayFabMultiplayerManager Network state becomes "NotInitialized" when returning to scene

Using Unity SDK

leader creates and joins network via:

PlayFabMultiplayerManager.Get().CreateAndJoinNetwork();

other players join lobby and leader shares network ID, players join network via

PlayFabMultiplayerManager.Get().JoinNetwork(networkID);

We can send messages back and forth, everything's great!

game is played by loading a new scene, match concludes and we return to lobby scene at this point the network the players have joined has changed to a state of "NotInitialized" and the players can no longer communicate via the network. Network is there, just not initialized, which I confirm by querying network state via

PlayFabMultiplayerManager.Get().State

Why is the network dropping to NotInitialize? How do I "restart" the network?

I thought to use Suspend() / Resume() or ResetParty() methods per the documentation here:

https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/networking/unity-party-api-reference/classes/playfabmultiplayermanager/

... but those methods don't exist in the SDK!

Any help would be greatly appreciated. Blocker for a key features for our title.

multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Xiao Zha avatar image
Xiao Zha answered

I cannot reproduce your problem. I used two scenes for testing, one is the DemoScene in the Party Unity SDK(https://github.com/PlayFab/PlayFabPartyUnity) and using DemoScript in the SDK, and the other is a newly created scene. I used the Unity method "SceneManager.LoadScene(index);" to switch between the two scenes. Also, I referred to https://community.playfab.com/questions/57498/party-load-new-scene-error-only-one-partymanager-i.html to change the Start function in PlayFabMultiplayerManager.cs to avoid duplicate PartyManager instance error. The state returned by "PlayFabMultiplayerManager.Get().State" is always "ConnectedToNetwork". Could you please provide us with detailed reproduction steps so that we can have better research.--

Additionally, the Suspend(), Resume(), and ResetParty() methods are not available in older versions of the Party Unity SDK. You can try updating the SDK to the latest version.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Evan Maxey avatar image Evan Maxey commented ·

upgraded but that wasn't it. somebody had put in a destructor as part of a test harness that was destroying the singleton

I removed it and all good now

thanks for the quick reply!

1 Like 1 ·
Xiao Zha avatar image Xiao Zha Evan Maxey commented ·

Glad to hear your issue resolved.

0 Likes 0 ·
Evan Maxey avatar image
Evan Maxey answered

thanks, I'll start with the SDK update and circle back ty! :)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.