docs.unity3d.com
    Show / Hide Table of Contents

    Struct ActionBuffers

    A structure that wraps the ActionSegment<T>s for a particular IActionReceiver and is used when OnActionReceived(ActionBuffers) is called.

    Inherited Members
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.MLAgents.Actuators
    Syntax
    public readonly struct ActionBuffers

    Constructors

    ActionBuffers(Single[], Int32[])

    Construct an ActionBuffers instance with the continuous and discrete actions that will be used. ///

    Declaration
    public ActionBuffers(float[] continuousActions, int[] discreteActions)
    Parameters
    Type Name Description
    Single[] continuousActions

    The continuous actions to send to an IActionReceiver.

    Int32[] discreteActions

    The discrete actions to send to an IActionReceiver.

    ActionBuffers(ActionSegment<Single>, ActionSegment<Int32>)

    Construct an ActionBuffers instance with the continuous and discrete actions that will be used.

    Declaration
    public ActionBuffers(ActionSegment<float> continuousActions, ActionSegment<int> discreteActions)
    Parameters
    Type Name Description
    ActionSegment<Single> continuousActions

    The continuous actions to send to an IActionReceiver.

    ActionSegment<Int32> discreteActions

    The discrete actions to send to an IActionReceiver.

    ActionBuffers(ActionSpec)

    Construct an ActionBuffers instance with ActionSpec. All values are initialized to zeros. ///

    Declaration
    public ActionBuffers(ActionSpec actionSpec)
    Parameters
    Type Name Description
    ActionSpec actionSpec

    The ActionSpec to send to an IActionReceiver.

    Fields

    Empty

    An empty action buffer.

    Declaration
    public static ActionBuffers Empty
    Field Value
    Type Description
    ActionBuffers

    Properties

    ContinuousActions

    Holds the Continuous ActionSegment<T> to be used by an IActionReceiver.

    Declaration
    public readonly ActionSegment<float> ContinuousActions { get; }
    Property Value
    Type Description
    ActionSegment<Single>

    DiscreteActions

    Holds the Discrete ActionSegment<T> to be used by an IActionReceiver.

    Declaration
    public readonly ActionSegment<int> DiscreteActions { get; }
    Property Value
    Type Description
    ActionSegment<Int32>

    Methods

    Clear()

    Clear the ContinuousActions and DiscreteActions segments to be all zeros.

    Declaration
    public readonly void Clear()

    Equals(Object)

    Indicates whether the current ActionBuffers is equal to another ActionBuffers.

    Declaration
    public override readonly bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    An ActionBuffers to compare with this ActionBuffers.

    Returns
    Type Description
    Boolean

    true if the current ActionBuffers is equal to the other parameter; otherwise, false.

    Overrides
    ValueType.Equals(Object)

    FromDiscreteActions(Single[])

    Create an ActionBuffers instance with discrete actions stored as a float array. This exists to achieve backward compatibility with the former Agent methods which used a float array for both continuous and discrete actions.

    Declaration
    public static ActionBuffers FromDiscreteActions(float[] discreteActions)
    Parameters
    Type Name Description
    Single[] discreteActions

    The float array of discrete actions.

    Returns
    Type Description
    ActionBuffers

    An ActionBuffers instance initialized with a DiscreteActions ActionSegment<T> initialized from a float array.

    GetHashCode()

    Computes the hash code of the ActionBuffers.

    Declaration
    public override readonly int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for the current ActionBuffers.

    Overrides
    ValueType.GetHashCode()

    IsEmpty()

    Check if the ActionBuffers is empty.

    Declaration
    public readonly bool IsEmpty()
    Returns
    Type Description
    Boolean

    Whether the buffers are empty.

    Back to top
    Terms of use
    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