Struct ActionBuffers
A structure that wraps the ActionSegment<T>s for a particular IActionReceiver and is used when OnActionReceived(ActionBuffers) is called.
Namespace: Unity.MLAgents.Actuators
Syntax
public struct ActionBuffersConstructors
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 EmptyField Value
| Type | Description | 
|---|---|
| ActionBuffers | 
Properties
ContinuousActions
Holds the Continuous ActionSegment<T> to be used by an IActionReceiver.
Declaration
public ActionSegment<float> ContinuousActions { get; }Property Value
| Type | Description | 
|---|---|
| ActionSegment<Single> | 
DiscreteActions
Holds the Discrete ActionSegment<T> to be used by an IActionReceiver.
Declaration
public ActionSegment<int> DiscreteActions { get; }Property Value
| Type | Description | 
|---|---|
| ActionSegment<Int32> | 
Methods
Clear()
Clear the ContinuousActions and DiscreteActions segments to be all zeros.
Declaration
public void Clear()Equals(Object)
Indicates whether the current ActionBuffers is equal to another ActionBuffers.
Declaration
public override 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. | 
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 int GetHashCode()Returns
| Type | Description | 
|---|---|
| Int32 | A hash code for the current ActionBuffers. | 
IsEmpty()
Check if the ActionBuffers is empty.
Declaration
public bool IsEmpty()Returns
| Type | Description | 
|---|---|
| Boolean | Whether the buffers are empty. |