void Start () {
        RegisterHandlers();

        UnityNetcode.QuerySupport((supportStatus) =>
        {
            if (supportStatus == NetcodeIOSupportStatus.Available)
            {
                Debug.LogError("Netcode.IO available and ready!");

                UnityNetcode.CreateClient(NetcodeIOClientProtocol.IPv4, (client) =>
                {
                    this.client = client;
                    client.SetTickrate(60);
                    //StartCoroutine(connectToServer());

                });
            }
            else if (supportStatus == NetcodeIOSupportStatus.Unavailable)
            {
                Debug.LogError("Netcode.IO not available");
            }
            else if (supportStatus == NetcodeIOSupportStatus.HelperNotInstalled)
            {
                Debug.LogError("Netcode.IO is available, but native helper is not installed");
            }
        });
	}
    private void Start()
    {
        logLine("Checking for Netcode.IO support...");

        UnityNetcode.QuerySupport((supportStatus) =>
        {
            if (supportStatus == NetcodeIOSupportStatus.Available)
            {
                logLine("Netcode.IO available and ready!");

                UnityNetcode.CreateClient(NetcodeIOClientProtocol.IPv4, (client) =>
                {
                    this.client = client;
                    StartCoroutine(connectToServer());
                });
            }
            else if (supportStatus == NetcodeIOSupportStatus.Unavailable)
            {
                logLine("Netcode.IO not available");
            }
            else if (supportStatus == NetcodeIOSupportStatus.HelperNotInstalled)
            {
                logLine("Netcode.IO is available, but native helper is not installed");
            }
        });
    }
예제 #3
0
 private void Connect(NetcodeIOClientProtocol protocol)
 {
     UnityNetcode.CreateClient(protocol, client =>
     {
         _client          = client;
         var connectToken = generateToken();
         client.Connect(connectToken, OnConnectSuccess, OnConnectFailure);
     });
 }
예제 #4
0
        private void ClientConnect(NetcodeClient client)
        {
            var token = new byte[32];

            client.Connect(token, ClientConnectSucceedCallback, ClientConnectFailedCallback);
        }
예제 #5
0
        void OnMessageReceive(NetcodeClient client, NetcodePacket packet)
        {
            var payload = packet.PacketBuffer.InternalBuffer;

            _reliableClient.ReceivePacket(payload, packet.PacketBuffer.Length);
        }
 void RecievePacket(NetcodeClient client, NetcodePacket packet)
 {
     reliableEndpoint.ReceivePacket(packet.PacketBuffer.InternalBuffer, packet.PacketBuffer.Length);
 }
 void ReceivePacket(NetcodeClient client, NetcodePacket packet)
 {
     received++;
     ReceivedText.text = "Received: " + received;
 }