public virtual void Send(PacketObject packet) { if (connected && packet != null && !packet.destroyed) { #if UNITY_EDITOR if (LocalServer.instance.AutoHandlePacket(packet.GetType(), this)) { return; } #endif var p = packet.BuildPacket(); #if DEVELOPMENT_BUILD || UNITY_EDITOR var f = ConfigManager.Get <ProtocolLoggerFilter>(packet._ID); if (!f || !f.disabled) { if (!f || !f.noDetail) { try { Logger.Log(LogType.SEND, "Send: [{0}:{1}-{2},{3}] {4}", p.ID, p.dataSize, Level.realTime, packet._name, LitJson.JsonMapper.ToJson(packet, true, 5, true)); } catch (Exception e) { Logger.Log(LogType.SEND, "Send: [{0}:{1}-{2},{3}]", p.ID, p.dataSize, Level.realTime, packet._name); Logger.LogException(e); } } else { Logger.Log(LogType.SEND, "Send: [{0}:{1}-{2},{3}]", p.ID, p.dataSize, Level.realTime, packet._name); } if (f && f.cpp) { packet.LogCppString(); } } #endif m_sender.Send(p); } if (!packet.dontDestroyOnSend) { packet.Destroy(); } }