void SendToServer(string message)
    {
        if (m_Driver.GetConnectionState(m_Connection) != NetworkConnection.State.Connected)
        {//Prevent InvalidOperationException
            Debug.Log("Can't Send to Invalid Connection");
            return;
        }

        var writer = m_Driver.BeginSend(m_Connection);
        NativeArray <byte> bytes = new NativeArray <byte>(Encoding.ASCII.GetBytes(message), Allocator.Temp);

        writer.WriteBytes(bytes);
        m_Driver.EndSend(writer);
    }
Example #2
0
 public State GetState(NetworkDriver driver)
 {
     return(driver.GetConnectionState(this));
 }