Beispiel #1
0
        public bool Send(int channelId, byte[] buffer, int length)
        {
#if NETWORK_DEBUGGER_ENABLED
            UnityEngine.Debug.Log($"ClientPeer Outgoing : ChannelId:{channelId} Size:{length}");
#endif
            byte error;
            UNET.NetworkTransport.Send(m_Connection.SocketId, m_Connection.ConnectionId, channelId, buffer, length, out error);

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

            m_Connection.LastError = (NetworkError)error;

            return(m_Connection.LastError == NetworkError.None);
        }