Skip to content

Commit c868a1c

Browse files
committed
Fixed an issue with the previous commit when sending custom user data using LiteNetLib.
1 parent b1e5484 commit c868a1c

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

Netick/Editor/Netick.Unity.Editor.dll

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Netick/Runtime/Netick.Unity.dll

0 Bytes
Binary file not shown.

Transport/LiteNetLib Transport/LiteNetLibTransportProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Net.Sockets;
88
using System;
99
using Netick.Unity;
10+
using UnityEngine.UIElements;
1011

1112
namespace Netick.Transport
1213
{
@@ -16,7 +17,7 @@ public class LiteNetLibTransportProvider : NetworkTransportProvider
1617
[Tooltip("Time duration (in seconds) until a connection is dropped when no packets were received.")]
1718
public float DisconnectTimeout = 5;
1819
[Tooltip("Time interval (in seconds) between connection attempts.")]
19-
public float ReconnectInterval = 0.5f;
20+
public float ReconnectInterval = 0.5f;
2021
[Tooltip("Max number of connect attempts.")]
2122
public int MaxConnectAttempts = 10;
2223
[Tooltip("LiteNetLib internal logic update interval (in seconds).")]
@@ -222,6 +223,10 @@ unsafe void INetEventListener.OnNetworkReceive(NetPeer peer, NetPacketReader rea
222223
if (_clients.TryGetValue(peer, out var c))
223224
{
224225
var len = reader.AvailableBytes;
226+
227+
if (_bytes.Length < reader.AvailableBytes)
228+
_bytes = new byte[reader.AvailableBytes];
229+
225230
reader. GetBytes(_bytes, 0, reader.AvailableBytes);
226231

227232
fixed(byte* ptr = _bytes)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.karrar.netick",
3-
"version": "0.12.23",
3+
"version": "0.12.24",
44
"displayName": "Netick",
55
"description": "A networking solution for Unity",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)