Class RawBytesChannel
Side channel for managing raw bytes of data. It is up to the clients of this side channel to interpret the messages.
Inherited Members
Namespace: Unity.MLAgents.SideChannels
Assembly: Unity.ML-Agents.dll
Syntax
public class RawBytesChannel : SideChannel
Constructors
RawBytesChannel(Guid)
RawBytesChannel provides a way to exchange raw byte arrays between Unity and Python.
Declaration
public RawBytesChannel(Guid channelId)
Parameters
Type | Name | Description |
---|---|---|
Guid | channelId | The identifier for the RawBytesChannel. Must be the same on Python and Unity. |
Methods
GetAndClearReceivedMessages()
Gets the messages that were sent by python since the last call to GetAndClearReceivedMessages.
Declaration
public IList<byte[]> GetAndClearReceivedMessages()
Returns
GetReceivedMessages()
Gets the messages that were sent by python since the last call to GetAndClearReceivedMessages. Note that the messages received will not be cleared with a call to GetReceivedMessages.
Declaration
public IList<byte[]> GetReceivedMessages()
Returns
OnMessageReceived(IncomingMessage)
Is called by the communicator every time a message is received from Python by the SideChannel. Can be called multiple times per simulation step if multiple messages were sent.
Declaration
protected override void OnMessageReceived(IncomingMessage msg)
Parameters
Type | Name | Description |
---|---|---|
Incoming |
msg | The incoming message. |
Overrides
SendRawBytes(byte[])
Sends the byte array message to the Python side channel. The message will be sent alongside the simulation step.
Declaration
public void SendRawBytes(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | The byte array of data to send to Python. |