The flowing shows where the bug occured, I was use the Unity2021.3, and build Target is WebGL.
private static KingClient _clientPeer;
private string _ip;
private ushort _port;
private NetworkListenerType _listenerType;
public ClientPeer_KingClient(string ip, ushort port)
{
_clientPeer = new();
_ip = ip;
_port = port;
_listenerType = NetworkListenerType.WSText;
}
public void Connect()
{
_clientPeer.Connect(_ip, _port, _listenerType);
if (_clientPeer.HasConnected) //This line will get the bug, null refrence.
{
Debug.Log("Connected!");
}
}
Thanks for your reading, and I am looking forward to your reply.