Class FloatPropertiesChannel
Side channel that is comprised of a collection of float variables.
Inherited Members
Namespace: Unity.MLAgents.SideChannels
Assembly: Unity.ML-Agents.dll
Syntax
public class FloatPropertiesChannel : SideChannel
Constructors
FloatPropertiesChannel(Guid)
Initializes the side channel with the provided channel ID.
Declaration
public FloatPropertiesChannel(Guid channelId = default)
Parameters
Type | Name | Description |
---|---|---|
Guid | channelId | ID for the side channel. |
Methods
GetWithDefault(string, float)
Get an Environment property with a default value. If there is a value for this property, it will be returned, otherwise, the default value will be returned.
Declaration
public float GetWithDefault(string key, float defaultValue)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string identifier of the property. |
float | defaultValue | The default value of the property. |
Returns
Type | Description |
---|---|
float | The parameter value associated with the provided key. |
Keys()
Returns a list of all the string identifiers of the properties currently present.
Declaration
public IList<string> Keys()
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
RegisterCallback(string, Action<float>)
Registers an action to be performed everytime the property is changed.
Declaration
public void RegisterCallback(string key, Action<float> action)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string identifier of the property. |
Action<float> | action | The action that ill be performed. Takes a float as input. |
Set(string, float)
Sets one of the float properties of the environment. This data will be sent to Python.
Declaration
public void Set(string key, float value)