using PhotonNetwork.ConnectUsingSettings(); do not connect and gives error in unity WebGl browser.

(unity version 2019.3.5 , Pun 2 . version 2.28.)

Here is the start function that im using to connect.

void Start()
{
PhotonNetwork.GameVersion = "1.0";
PhotonNetwork.ConnectUsingSettings();
}

it works fine in unity editor but not in the browser. i have my domain and hosting, The scene loads fine but when the PhotonNetwork.ConnectUsingSettings(); called it gives following error

[style color="Red"] Connect() failed to create a IPhotonSocket instance for WebSocketSecure. SocketImplementationConfig: {Udp=ExitGames.Client.Photon.SocketUdp, Tcp=ExitGames.Client.Photon.SocketTcp, WebSocket=ExitGames.Client.Photon.SocketWebTcp, WebSocketSecure=ExitGames.Client.Photon.SocketWebTcp} Exception: System.MissingMethodException: Constructor on type 'ExitGames.Client.Photon.SocketWebTcp' not found.
at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
[style]

This is the PhotonServerSettings.

[img]file:///C:/Users/Welcome/Documents/photonserversettings.PNG[/img]

i've tried different solutions, There was a fix on website but this is already implemented in this version of PUN2.
file:///C:/Users/Welcome/Documents/fix.PNG

Help me solving this problem, Thanks

Comments

  • TobiasTobias admin
    The SocketWebTcp should be in the project. It seems the code stripping of Unity is dropping the constructor on build, so this fails.

    Put a `[Preserve]` attribute on the class and the constructor.
    Or use the link.xml to make sure the code stripping does not drop anything in this class.

    It might be related to the version of Unity, which you are using. You should update to a recent LTS version and use latest PUN 2.
Sign In or Register to comment.