/// <summary> /// Reads one packet from NetDataReader and calls OnReceive delegate /// </summary> /// <param name="reader">NetDataReader with packet</param> /// <param name="userData">Argument that passed to OnReceivedEvent</param> public void ReadPacket(NetDataReader reader, object userData) { StructInfo info = ReadInfo(reader); if (info.CreatorFunc != null) { info.Reference = info.CreatorFunc(); } info.Read(reader); info.OnReceive(info.Reference, userData); }