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”
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.