Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947
↧

Can't make a room: CreateRoom failed. Client is on MasterServer

$
0
0
When I try to make a room, it always fails with this error message:
CreateRoom failed. Client is on MasterServer (must be Master Server for matchmaking)but not ready for operations (State: Joining). Wait for callback: OnJoinedLobby or OnConnectedToMaster.
UnityEngine.Debug:LogError(Object)
Photon.Pun.PhotonNetwork:CreateRoom(String, RoomOptions, TypedLobby, String[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1657)
View.StartScene.CreateServerView:CreateServer() (at Assets/UI/StartScene/CreateServerView/CreateServerView.cs:70)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.4.3f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

I connected to Photon Network by these lines of code:
void ConnectToPhotonNetwork() {
    PhotonNetwork.AddCallbackTarget(this);
    PhotonNetwork.GameVersion = "1.0.0";
    PhotonNetwork.ConnectUsingSettings();
}

And this is a code for creating a room:
PhotonNetwork.CreateRoom(serverName, new RoomOptions() {
    MaxPlayers = 2,
});

Note that I attempted to create a room after "OnConnectedToMaster" invoked. As far as I know, the player doesn't have to join the lobby from the PUN 2, so I didn't put any code for joining the lobby.

I was just following the tutorial and example here:
https://doc.photonengine.com/zh-cn/pun/v2/demos-and-tutorials/pun-basics-tutorial/lobby

The only difference is that I'm not inheriting MonoBehaviourPunCallbacks, instead, I'm registering a callback target that having these interfaces:
https://doc-api.photonengine.com/en/dotnet/current/interface_photon_1_1_realtime_1_1_i_connection_callbacks.html
https://doc-api.photonengine.com/en/dotnet/current/interface_photon_1_1_realtime_1_1_i_in_room_callbacks.html

I couldn't find any related info or solution about this issue, and also couldn't find it in the documentation. Is there something that missed? Should be something do between "OnConnectedToMaster" and creating a room?
↧

Viewing all articles
Browse latest Browse all 8947


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>