Hi there,
I have a question that I need help with. I'd like to first know if first I have the correct approach and secondly if I do, what am I doing wrong? In my game, at the start the user first connects to a database to collect his account information. Once that happens, I do a few things:
PhotonNetwork.autoJoinLobby = false;
PhotonNetwork.automaticallySyncScene = true;
PhotonNetwork.offlineMode = true;
PhotonNetwork.CreateRoom("MainMenu");
While the user is in the Main Menu, he doesn't need to connect to Photon but I do need some of the Photon functionality like the use of RPCs. From the Main Menu, the user can click on "Find Match" where he gets paired up with a single opponent. Players have a personal rating and when they search for a match, they do 8 searches in a row looking for an opponent with the closest rating to theirs. So if they're at 1500 rating, they'll look for someone between 1450 and 1550, if nobody is available then 1400 and 1600 and so on for a total of 8 iterations. If nothing is found, they create their own room and place their own rating in the room options so other people looking for matches can get paired with them.
So when the player presses the "Find Match" button, I do the following:
PhotonNetwork.ConnectUsingSettings(); // with the game version inside ()
I immediately get a notification of "ConnectUsingSettings() disabled the offline mode. No longer offline."
I also get "Best region found in PlayerPrefs. Connecting to: eu"
And "OnConnectedToPhoton" and "OnConnectedToMaster" get called.
The "OnConnectedToMaster" callback checks if we're looking for a match and if we are, it does the custom search for an opponent described above and if it can't find anyone it creates a room.
So far, so good, everything seems to work perfectly. Now I also have a "Cancel Search" button. When pressed I do the following:
PhotonNetwork.Disconnect();
PhotonNetwork.offlineMode = true;
PhotonNetwork.LeaveRoom();
PhotonNetwork.CreateRoom("MainMenu");
If I press the "Cancel Search" button and then I press the "Find Match" button again, I only get as far as "Best region found in PlayerPrefs. Connecting to: eu". "OnConnectedToPhoton" and "OnConnectedToMaster" no longer get called. What am I doing wrong and is this a proper way of doing things?
Thank you!
I have a question that I need help with. I'd like to first know if first I have the correct approach and secondly if I do, what am I doing wrong? In my game, at the start the user first connects to a database to collect his account information. Once that happens, I do a few things:
PhotonNetwork.autoJoinLobby = false;
PhotonNetwork.automaticallySyncScene = true;
PhotonNetwork.offlineMode = true;
PhotonNetwork.CreateRoom("MainMenu");
While the user is in the Main Menu, he doesn't need to connect to Photon but I do need some of the Photon functionality like the use of RPCs. From the Main Menu, the user can click on "Find Match" where he gets paired up with a single opponent. Players have a personal rating and when they search for a match, they do 8 searches in a row looking for an opponent with the closest rating to theirs. So if they're at 1500 rating, they'll look for someone between 1450 and 1550, if nobody is available then 1400 and 1600 and so on for a total of 8 iterations. If nothing is found, they create their own room and place their own rating in the room options so other people looking for matches can get paired with them.
So when the player presses the "Find Match" button, I do the following:
PhotonNetwork.ConnectUsingSettings(); // with the game version inside ()
I immediately get a notification of "ConnectUsingSettings() disabled the offline mode. No longer offline."
I also get "Best region found in PlayerPrefs. Connecting to: eu"
And "OnConnectedToPhoton" and "OnConnectedToMaster" get called.
The "OnConnectedToMaster" callback checks if we're looking for a match and if we are, it does the custom search for an opponent described above and if it can't find anyone it creates a room.
So far, so good, everything seems to work perfectly. Now I also have a "Cancel Search" button. When pressed I do the following:
PhotonNetwork.Disconnect();
PhotonNetwork.offlineMode = true;
PhotonNetwork.LeaveRoom();
PhotonNetwork.CreateRoom("MainMenu");
If I press the "Cancel Search" button and then I press the "Find Match" button again, I only get as far as "Best region found in PlayerPrefs. Connecting to: eu". "OnConnectedToPhoton" and "OnConnectedToMaster" no longer get called. What am I doing wrong and is this a proper way of doing things?
Thank you!