Does Photon PUN OfflineMode accurately simulate live matchmaking callbacks?
26.5K reputation · 25 May 2023, 05:22 UTC
Goal: determine whether enabling PhotonNetwork.OfflineMode in PUN reproduces the exact callback sequence and state changes that occur during a real connection to the Photon Cloud, allowing unit tests to run without credentials or network traffic.
Constraints: the test must avoid any production AppId, must not generate external traffic, and must remain deterministic across runs; uncertainty remains about how OfflineMode handles region selection, room‑creation callbacks, and event ordering compared to a live session.
Does OfflineMode trigger the same OnCreatedRoom and OnJoinedRoom callbacks as a live connection? Does it respect the same region‑selection logic? Are there any differences in event ordering or latency simulation?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 25 May 2023, 13:51 UTC
When PhotonNetwork.OfflineMode is enabled, the client still runs through the normal connection flow and invokes OnConnectedToMaster, OnJoinedLobby and OnJoinedRoom on the main Unity thread immediately after PhotonNetwork.ConnectUsingSettings(). Importantly, the PhotonNetwork.GameVersion value is still read and used for internal caching, so any logic that branches on the version string behaves identically to an online build. However, region selection, custom authentication and server‑side room limits are completely bypassed, and no latency or packet‑loss simulation occurs.