void HandleLeaveRoom(bool okay, SWLobbyError error) { if (!okay) { Debug.LogError(error); } Debug.Log("Left room"); SceneManager.LoadScene("lobbyScene"); }
/// <summary> /// Callback method for NetworkClient.Lobby.JoinOrCreateRoom(). /// </summary> /// <param name="successful">If set to <c>true</c> <paramref name="successful"/>, the player has joined or created a room.</param> /// <param name="reply">Reply.</param> /// <param name="error">Error.</param> void HandleJoinOrCreatedRoom(bool successful, SWJoinRoomReply reply, SWLobbyError error) { if (successful) { Debug.Log("Joined or created room " + reply); // the player has joined a room which has already started. if (reply.started) { ConnectToRoom(); } else if (NetworkClient.Lobby.IsOwner) { // the player did not find a room to join // the player created a new room and became the room owner. StartRoom(); } } else { Debug.Log("Failed to join or create room " + error); } }