PUN doesn't work in release builds, but it works in Development Builds
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
PUN doesn't work in release builds, but it works in Development Builds
greedilez
2022-08-12 11:51:10
When building a release build on any platform, it is not possible to connect to the master, but the development build works fine on any platform, please help!
Comments
Any logged errors? Which version is it?
Tobias 2022-08-12T11:52:00+00:00
Any logged errors? Which version is it?
No errors, only warnings, they are shown below.
WebGL requires WebSockets. Switching TransportProtocol to WebSocketSecure.
UnityEngine.Debug:LogWarning (object)
Photon.Realtime.LoadBalancingClient:DebugReturn (ExitGames.Client.Photon.DebugLevel,string) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2577)
Photon.Realtime.LoadBalancingClient:CheckConnectSetupWebGl () (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1135)
Photon.Realtime.LoadBalancingClient:ConnectToNameServer () (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1022)
Photon.Pun.PhotonNetwork:ConnectToBestCloudServer () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1307)
Photon.Pun.PhotonNetwork:ConnectUsingSettings (Photon.Realtime.AppSettings,bool) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1207)
Photon.Pun.PhotonNetwork:ConnectUsingSettings () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1130)
Menu:Awake () (at Assets/Scripts/Menu.cs:13)
PUN is in development mode (development build). As the 'dev region' is not empty (ru) it overrides the found best region. See PhotonServerSettings.
UnityEngine.Debug:LogWarning (object)
Photon.Pun.PhotonNetwork:OnRegionsPinged (Photon.Realtime.RegionHandler) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2538)
Photon.Realtime.RegionHandler:OnPreferredRegionPinged (Photon.Realtime.Region) (at Assets/Photon/PhotonRealtime/Code/RegionHandler.cs:281)
Photon.Realtime.RegionPinger/<RegionPingCoroutine>d__17:MoveNext () (at Assets/Photon/PhotonRealtime/Code/RegionHandler.cs:605)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
When you try to connect to the master:
Failed to join room cause Game does not exist
UnityEngine.Debug:Log (object)
Menu:OnJoinRoomFailed (int16,string) (at Assets/Scripts/Menu.cs:21)
Photon.Realtime.MatchMakingCallbacksContainer:OnJoinRoomFailed (int16,string) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:4232)
Photon.Realtime.LoadBalancingClient:CallbackRoomEnterFailed (ExitGames.Client.Photon.OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2596)
Photon.Realtime.LoadBalancingClient:OnOperationResponse (ExitGames.Client.Photon.OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2843)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) (at C:/Dev/photon-sdk-dotnet/PhotonDotNet/PeerBase.cs:872)
ExitGames.Client.Photon.TPeer:DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotNet/TPeer.cs:253)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotNet/PhotonPeer.cs:1771)
Photon.Pun.PhotonHandler:Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:226)
Photon.Pun.PhotonHandler:FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:145)
and after, nothing happens, the master is located on the itch.io server, the client connects through the editor
Pun version: 2.41, Photon lib: 4.1.6.17, Unity 2021.3.4f1
My connection script:
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using TMPro;
public class Menu : MonoBehaviourPunCallbacks
{
[SerializeField] private TMP_InputField joinRoomInput, createRoomInput;
private void Awake(){
if(!PhotonNetwork.IsConnected){
PhotonNetwork.AutomaticallySyncScene = true;
PhotonNetwork.ConnectUsingSettings();
}
}
public void JoinRoomByName() => PhotonNetwork.JoinRoom(joinRoomInput.text);
public override void OnJoinedRoom() => Debug.Log("Successfully joined room.");
public override void OnJoinRoomFailed(short returnCode, string message) => Debug.Log($"Failed to join room cause {message}");
public void CreateRoomByName() => PhotonNetwork.CreateRoom(createRoomInput.text, new RoomOptions{ MaxPlayers = 5 });
public override void OnCreatedRoom(){
Debug.Log("Created room successfully.");
if(PhotonNetwork.IsMasterClient) PhotonNetwork.LoadLevel(1);
}
public override void OnCreateRoomFailed(short returnCode, string message) => Debug.Log($"Failed to create room cause {message}");
}
When you edit your post, select the code and logs. There is a "paragraph"-sign on the left. Click, then click the Quotation marks (special formatting) and then apply "Code Block" formatting.
Your release game does not use the Development Region.
So you get "Failed to join room cause Game does not exist" maybe because your clients didn't end up in the same region?! Enable the SupportLogger and you can find the region in the logs. Compare between clients that should join one anothers games.
Tobias 2022-08-12T12:09:14+00:00
Your release game does not use the Development Region.
So you get "Failed to join room cause Game does not exist" maybe because your clients didn't end up in the same region?! Enable the SupportLogger and you can find the region in the logs. Compare between clients that should join one anothers games.
I turned off the dev region (left the line empty), turned off the development build, made a new build, and everything worked out well, thanks for the help!
Back to top