Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party Photon 2D multiplayer game not working with webgl (tobiass please help)

Discussion in 'Multiplayer' started by dylanisbored, Jul 26, 2023.

  1. dylanisbored

    dylanisbored

    Joined:
    Aug 7, 2022
    Posts:
    1
    I am trying to create my first webgl game that is online. I used the updated pun2.0 version, and unity 2022.3.4f1. My code for the launcher is very simple and is as follows:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Photon.Pun;
    public class SimpleLauncher : MonoBehaviourPunCallbacks
    {
    public PhotonView player;
    // Start is called before the first frame update
    void Start()
    {
    Debug.Log("start");
    PhotonNetwork.ConnectUsingSettings();
    Debug.Log("connected");
    }
    // Update is called once per frame
    public override void OnConnectedToMaster()
    {
    Debug.Log("Connected to master");
    PhotonNetwork.JoinRandomOrCreateRoom();
    }
    public override void OnJoinedRoom()
    {
    Debug.Log("joined room!");
    PhotonNetwork.Instantiate(player.name, Vector3.zero, Quaternion.identity);
    }
    }
    When on windows and editor, it connects fine, and when switching to Webgl, it works fine in editor. Then, when i upload it at multiplayer.dylansantwani1.repl.co, it stays in the loading screen and does not connect. When I go back to the editor after, it says "tls handshake failed"
     
  2. Lukeesta

    Lukeesta

    Joined:
    Jan 7, 2016
    Posts:
    77
    You can either switch the protocol to `Websocket` instead of `Websocket Secure` or you will need to generate a valid SSL certificate for your domain.