PUN Doesn't work on Release build, works inside editor and in Development build.

Options
In the release build it doesn't say anything like failed to join or anything. It just goes "You're not connected to the PUN network" when trying to join a room. Anyone know what the issue might be? We're using unity 2017.1.0f3 Personal.

Best Answer

  • Ecoste
    Ecoste
    Answer ✓
    Options
    @Christian_Simon

    I fixed it, it was a pretty dumb reason.

    I had

    Debug.Assert(PhotonNetwork.ConnectUsingSettings(Settings.version) == true, "Failed to connect to the Photon Network.");

    And obviously assertations don't run in the release build.

Answers

  • Ecoste
    Options
    I should mention that we're trying to do this on WebGL.
  • [Deleted User]
    edited August 2017
    Options
    Hi @Ecoste,

    did a quick test with one of the included demos and it worked with Unity 2017, WebGL as target platform with 'release' option.

    When creating the room make sure that you are connected to Photon. You can also add some 'visual logging' by using Unity's OnGUI function in order to print warning and error messages on the screen. Interesting to know would be if OnFailedToConnectToPhoton, OnConnectionFail or OnDisconnectedFromPhoton is called. Furthermore would be interesting if the connection at least could be established. You can check this by adding OnConnectedToPhoton and OnConnectedToMaster. At least one of those should be called when being connected to Photon.

    Edit: Can you please tell us which PUN version you are currently using and if you use the Best Region option?
  • Ecoste
    Ecoste
    Answer ✓
    Options
    @Christian_Simon

    I fixed it, it was a pretty dumb reason.

    I had

    Debug.Assert(PhotonNetwork.ConnectUsingSettings(Settings.version) == true, "Failed to connect to the Photon Network.");

    And obviously assertations don't run in the release build.