Beispiel #1
0
        void HandleDataEvent(int channelId, int receivedSize)
        {
#if NETWORK_DEBUGGER_ENABLED
            UnityEngine.Debug.Log($"ClientPeer Incoming : ChannelId:{channelId} Size:{receivedSize}");
#endif

#if NETWORK_PROFILER_ENABLED && UNITY_EDITOR
            var profilerName = new StringBuilder(PROFILER_CATEGORY_PREFIX);
            profilerName.Append(channelId);
            NetworkProfiler.RecordChannelIncoming(profilerName.ToString(), (ushort)receivedSize);
#endif

            DataEvent?.Invoke(channelId, m_RecievedBuffer, receivedSize);
        }
Beispiel #2
0
        void HandleData(int connectionId, int channelId, int receivedSize, NetworkError error)
        {
            var client = FindConnection(connectionId);

            if (client == null)
            {
                return;
            }

            client.LastError = error;

#if NETWORK_DEBUGGER_ENABLED
            UnityEngine.Debug.Log($"ServerPeer Incoming : ConnectionId:{connectionId}, Size:{receivedSize}");
#endif

#if NETWORK_PROFILER_ENABLED && UNITY_EDITOR
            var profilerName = new StringBuilder(PROFILER_CATEGORY_PREFIX);
            profilerName.Append(channelId);
            NetworkProfiler.RecordChannelIncoming(profilerName.ToString(), (ushort)receivedSize);
#endif

            DataEvent?.Invoke(client, channelId, m_RecievedBuffer, receivedSize);
        }