Click or drag to resize

NetPacketProcessorSubscribeT(ActionT, FuncT) Method

Register and subscribe to packet receive event

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>(
	Action<T> onReceive,
	Func<T> packetConstructor
)
where T : class, new()

Parameters

onReceive  ActionT
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
Exceptions
ExceptionCondition
InvalidTypeExceptionT's fields are not supported, or it has no fields
See Also