- Home /
How to make 2 separated rooms PUN
hi guys just a question. i am making a multiplayer i did most of the network manager by watching a tutorial and it works fine on ( PhotonNetwork.ConnectUsingSettings("The_Station"); ) and when a other game is booted it will join the created room. no problem this was for my multiplayer button but a wanted to make an other button like Co-Op so lets say 2 players can do a mission together. so what is the best way to separated these 2 so when someone wants multiplayer it joins that room like in the fist place and when someone clicks Co-Op it joins or creates a room thats only acceseble for Co-Op players i did put in a bool that says isCo_Op == true or false that gets true or false depending on the selected button i wanted to use the same level i did put in my network manager to sctivate a mission when co-op is true and when co-op is false do multiplayer on the map
public void UIMulti_Player()
{
connecting = true;
Connect();
}
public void UICo_Op()
{
isCo_Op = true;
connecting = true;
Connect();
}
\\........................................................................................//
void Connect()
{
if (isPickedLevelTheStation == true)
{
PhotonNetwork.ConnectUsingSettings("The_Station");
}
if (isPickedLevel_Drilling_platform == true)
{
PhotonNetwork.ConnectUsingSettings("Drilling_platform");
}
}
\...............................................................................//
public void OnJoinedLobby()
{
Debug.Log("OnJoinedLobby");
if (isCo_Op == false)
{
PhotonNetwork.JoinRandomRoom();
}
if(isCo_Op == true)
{
?????
}
}
void OnPhotonRandomJoinFailed()
{
Debug.Log("OnPhotonRandomJoinFailed");
PhotonNetwork.CreateRoom(null);
}
\.............................................................................//
void OnJoinedRoom()
{
//FindObjectOfType<PhotonSceneSpawn>().BroadcastMessage("JoindLobbyRoom");
Debug.Log("OnJoinedRoom");
connecting = false;
//SpawnMyPlayer();
PhotonView photonView = this.GetComponent<PhotonView>();
//GameObject General = PhotonNetwork.Instantiate("Enemy`s", gameObject.transform.position, Quaternion.identity, 0);
}