Hi All,
first of all sorry for my bad Englsih, i'm going to try to be clear.
I'm making a 2d board game and I use PUN for online parties. So there are two players in a room. When the first player (Player 1) is connected, he loads his scene and waits for an opponent. When a second player (Player 2) connects, he loads another scene. So we have two scenes in a room, but only holes and panws of the board game are instantiate between the two players. And then, I close the room.
At the end of the game when, they want to restart, I send RPC, and they restart...but I have an issue. When they restart, for example, if I have a player (player 3) waiting for an oppenent, this player is going to play with player 1 or player 2, if it is player 1 who restarts first or not.
Sometimes the two players restart at the same moment, so they quit the initial room and I have two masters clients waiting for an oppenent.
So I think that when they restart, the room re-open. How can I keep the room closed and restart game inside ? I just want my player 1 to replay against the player 2.
I can't use PhotonNetwork.LoadLevel because, as I said above, each player loads his scene, and I sync holes and pawns...
Please I need help.
this is my code for to restart the game :
[PunRPC]
public void PreparartionRestart(int view)
{
GameObject gameManager = PhotonView.Find(view).gameObject;
Text textD = GameObject.Find("TextDebug").GetComponent<Text>();
textD.text = "back in the client ";
Debug.Log("in the method");
gameManager.GetComponent<PhotonView>().RPC("PreparartionRestart", PhotonTargets.OthersBuffered, new object[] { view });
SceneManager.LoadSceneAsync("Jeu");
}