/// <summary> /// Sends provided serializableData object to the server. /// </summary> /// <param name="serializableData">Data object to send. Must be a serializable class.</param> /// <returns>Whether the operation succeeded.</returns> public bool SendData(object serializableData, int channel = Channel.ReliableSequenced) { if (isConnected == false) { return(false); } var result = connection.Send(serializableData, channel); if (result == UnityEngine.Networking.NetworkError.Ok) { OnDataSent?.Raise(this, serializableData); } return(result == UnityEngine.Networking.NetworkError.Ok); }
protected void HandleDataSent() { OnDataSent?.Raise(this); }