Skip to content

Commit

Permalink
Add component menues for some sensors and actuators. (#5001) (#5002)
Browse files Browse the repository at this point in the history
  • Loading branch information
surfnerd authored Feb 24, 2021
1 parent 60d5d93 commit dd4fd79
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Unity.MLAgents.Extensions.Input
/// <see cref="InputActionActuator"/>s.
/// </summary>
[RequireComponent(typeof(PlayerInput), typeof(IInputActionAssetProvider))]
[AddComponentMenu("ML Agents/Input Actuator", (int)MenuGroup.Actuators)]
public class InputActuatorComponent : ActuatorComponent
{
InputActionAsset m_InputAsset;
Expand Down Expand Up @@ -234,7 +235,7 @@ internal static InputControlScheme CreateControlScheme(InputControl device,
}

var inputControlScheme = new InputControlScheme(
mlAgentsControlSchemeName,
mlAgentsControlSchemeName,
deviceRequirements);

return inputControlScheme;
Expand All @@ -261,14 +262,13 @@ internal static void RegisterLayoutBuilder(InputActionMap defaultMap, string lay
var builder = new InputControlLayout.Builder()
.WithName(layoutName)
.WithFormat(mlAgentsLayoutFormat);
for(var i = 0; i < defaultMap.actions.Count; i++)
for (var i = 0; i < defaultMap.actions.Count; i++)
{
var action = defaultMap.actions[i];
builder.AddControl(action.name)
.WithLayout(action.expectedControlType);
}
return builder.Build();

}, layoutName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Unity.MLAgents.Extensions.Match3
/// <summary>
/// Actuator component for a Match3 game. Generates a Match3Actuator at runtime.
/// </summary>
[AddComponentMenu("ML Agents/Match 3 Actuator", (int)MenuGroup.Actuators)]
public class Match3ActuatorComponent : ActuatorComponent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Unity.MLAgents.Sensors;
using UnityEngine;

namespace Unity.MLAgents.Extensions.Match3
{
/// <summary>
/// Sensor component for a Match3 game.
/// </summary>
[AddComponentMenu("ML Agents/Match 3 Sensor", (int)MenuGroup.Sensors)]
public class Match3SensorComponent : SensorComponent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Unity.MLAgents.Extensions.Sensors
/// <summary>
/// Grid-based sensor.
/// </summary>
[AddComponentMenu("ML Agents/Grid Sensor", (int)MenuGroup.Sensors)]
public class GridSensor : SensorComponent, ISensor, IBuiltInSensor
{
/// <summary>
Expand Down Expand Up @@ -480,7 +481,6 @@ public BuiltInSensorType GetBuiltInSensorType()
return BuiltInSensorType.GridSensor;
}


/// <summary>
/// GetCompressedObservation - Calls Perceive then puts the data stored on the perception buffer
/// onto the m_perceptionTexture2D to be converted to a byte array and returned
Expand Down
3 changes: 2 additions & 1 deletion com.unity.ml-agents/Runtime/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Unity.MLAgents
internal enum MenuGroup
{
Default = 0,
Sensors = 50
Sensors = 50,
Actuators = 100
}
}

0 comments on commit dd4fd79

Please sign in to comment.