docs.unity3d.com
    Show / Hide Table of Contents

    Class RawBytesChannel

    Side channel for managing raw bytes of data. It is up to the clients of this side channel to interpret the messages.

    Inheritance
    Object
    SideChannel
    RawBytesChannel
    Inherited Members
    SideChannel.ChannelId
    SideChannel.QueueMessageToSend(OutgoingMessage)
    Namespace: Unity.MLAgents.SideChannels
    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
    Type Description
    IList<Byte[]>

    a list of byte array messages that Python has sent.

    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
    Type Description
    IList<Byte[]>

    a list of byte array messages that Python has sent.

    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
    IncomingMessage msg

    The incoming message.

    Overrides
    SideChannel.OnMessageReceived(IncomingMessage)

    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.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023