SendUnreliable() public méthode

This sends a network message with a message ID on the connection. This message is sent on channel one, which by default is the unreliable channel.

public SendUnreliable ( short msgType, MessageBase msg ) : bool
msgType short The message ID to send.
msg MessageBase The message to send.
Résultat bool
Exemple #1
0
        public bool SendUnreliable(short msgType, MessageBase msg)
        {
            if (m_Connection != null)
            {
                if (m_AsyncConnect != ConnectState.Connected)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("NetworkClient SendUnreliable when not connected to a server");
                    }
                    return(false);
                }
#if UNITY_EDITOR
                UnityEditor.NetworkDetailStats.IncrementStat(
                    UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
                    MsgType.UserMessage, msgType.ToString() + ":" + msg.GetType().Name, 1);
#endif
                return(m_Connection.SendUnreliable(msgType, msg));
            }
            if (LogFilter.logError)
            {
                Debug.LogError("NetworkClient SendUnreliable with no connection");
            }
            return(false);
        }
Exemple #2
0
 public bool SendUnreliable(short msgType, MessageBase msg)
 {
     if (m_Connection != null)
     {
         if (m_AsyncConnect != ConnectState.Connected)
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("NetworkClient SendUnreliable when not connected to a server");
             }
             return(false);
         }
         return(m_Connection.SendUnreliable(msgType, msg));
     }
     if (LogFilter.logError)
     {
         Debug.LogError("NetworkClient SendUnreliable with no connection");
     }
     return(false);
 }