NetSerializerSubscribeT, TUserData Method (ActionT, TUserData, FuncT) |
LiteNetLib |
Register and subscribe to packet receive event (with userData)
Namespace: LiteNetLib.Utils
Assembly: LiteNetLib (in LiteNetLib.dll) Version: 1.0.0.0
Syntax
C#
public void Subscribe<T, TUserData>( Action<T, TUserData> onReceive, Func<T> packetConstructor ) where T : class, new()
Parameters
- onReceive
- Type: SystemActionT, TUserData
event that will be called when packet deserialized with ReadPacket method - packetConstructor
- Type: SystemFuncT
Method that constructs packet intead of slow Activator.CreateInstance
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:LiteNetLib.Utils.NetSerializer.Subscribe``2(System.Action{``0,``1},System.Func{``0})"]
- TUserData
[Missing <typeparam name="TUserData"/> documentation for "M:LiteNetLib.Utils.NetSerializer.Subscribe``2(System.Action{``0,``1},System.Func{``0})"]
See Also