Class SideChannel
Side channels provide an alternative mechanism of sending/receiving data from Unity to Python that is outside of the traditional machine learning loop. ML-Agents provides some specific implementations of side channels, but users can create their own.
To create your own, you'll need to create two, new mirrored classes, one in Unity (by
extending Side
Inherited Members
Namespace: Unity.MLAgents.SideChannels
Assembly: Unity.ML-Agents.dll
Syntax
public abstract class SideChannel
Properties
ChannelId
An int identifier for the SideChannel. Ensures that there is only ever one side channel of each type. Ensure the Unity side channels will be linked to their Python equivalent.
Declaration
public Guid ChannelId { get; protected set; }
Property Value
Type | Description |
---|---|
Guid | The integer identifier of the SideChannel. |
Methods
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 abstract void OnMessageReceived(IncomingMessage msg)
Parameters
Type | Name | Description |
---|---|---|
Incoming |
msg | The incoming message. |
QueueMessageToSend(OutgoingMessage)
Queues a message to be sent to Python during the next simulation step.
Declaration
protected void QueueMessageToSend(OutgoingMessage msg)
Parameters
Type | Name | Description |
---|---|---|
Outgoing |
msg | The byte array of data to be sent to Python. |