question

Abdul Ahmad avatar image
Abdul Ahmad asked

Party - load new scene error: only one PartyManager instance may exist at a time

I have a game (unity) where the players do matchmaking and join a party in the first scene, and then they're all moved into another scene to play the game. I have a playfabMultiplayerManager prefab in both scenes, but when the second scene loads i get these 2 errors:

only one PartyManager instance may exist at a time

and

The Party DLL could not be unloaded. Please restart Unity to unload it.

not sure what the right way to do this is. Do I just have the playfabMultiplayerManager in the first scene? or do I have it only in the second scene?

Matchmaking
10 |1200

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

Rick Chen avatar image
Rick Chen answered

Currently, the PlayFabMultiplayerManager does not support switching back to the scene that creates the PlayFabMultiplayerManager instance. As a workaround, you can change the Start function in PlayFabMultiplayerManager.cs from

private void Start()
{
_Initialize();
}

to

private void Start()
{
if (_multiplayerManager != null)
{
gameObject.SetActive(false);
Destroy(gameObject);
}
else
{
_multiplayerManager = this;
_Initialize();
}
}

such that you can avoid creating duplicate instance of the PlayFabMultiplayerManager.

10 |1200

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

Rick Chen avatar image
Rick Chen answered

The Prefab PlayFabMultiplayerManager is a singleton and you don’t need to put it in every scene. You can put it in the first scene and it will not be destroyed when you switch the scene.

1 comment
10 |1200

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

Abdul Ahmad avatar image Abdul Ahmad commented ·

thanks, that makes sense. I removed the manager from my second scene and the error went away. However, when I go back to the first scene (this happens after a game ends because the game goes back to the "Main Menu" scene) I see these errors again. Is there a work-around for this? Should I just ignore the errors if things continue working? (I still have to test if things are working OK after these errors are displayed)

0 Likes 0 ·

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.