Click or drag to resize

NetPacketProcessorSubscribeNetSerializableT, TUserData(ActionT, TUserData) Method

Registers a callback for a packet type that implements INetSerializable and has a parameterless constructor, supporting user data.

Namespace: LiteNetLib.Utils
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.2.1.0 (2026.2.1.0)
Syntax
C#
public void SubscribeNetSerializable<T, TUserData>(
	Action<T, TUserData> onReceive
)
where T : new(), INetSerializable

Parameters

onReceive  ActionT, TUserData
The delegate to be executed when the packet is received.

Type Parameters

T
The type of the packet. Must implement INetSerializable and have a new() constraint.
TUserData
The type of the user data (typically NetPeer).
Remarks
To reduce allocations, this method uses a single internal reference to T for deserialization.
See Also