Click or drag to resize

NetPacketProcessorSubscribeT, TUserData(ActionT, TUserData, FuncT) Method

Register and subscribe to packet receive event (with userData)

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

Parameters

onReceive  ActionT, TUserData
event that will be called when packet deserialized with ReadPacket method
packetConstructor  FuncT
Method that constructs packet instead of slow Activator.CreateInstance

Type Parameters

T
TUserData
Exceptions
ExceptionCondition
InvalidTypeExceptionT's fields are not supported, or it has no fields
See Also