Skip to content

Commit 25f3697

Browse files
author
Chris Elion
authored
Use AddComponentMenu for MonoBehaviours (#3231)
* Set AddComponentMenu for MonoBehaviours * don't add Monitor * pass componentOrder instead of nesting
1 parent 40d6dc9 commit 25f3697

File tree

9 files changed

+23
-1
lines changed

9 files changed

+23
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace MLAgents
2+
{
3+
/// <summary>
4+
/// Grouping for use in AddComponentMenu (instead of nesting the menus).
5+
/// </summary>
6+
public enum MenuGroup
7+
{
8+
Default=0,
9+
Sensors=50
10+
}
11+
}

UnitySDK/Assets/ML-Agents/Scripts/Constants.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitySDK/Assets/ML-Agents/Scripts/DemonstrationRecorder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace MLAgents
1010
/// Demonstration Recorder Component.
1111
/// </summary>
1212
[RequireComponent(typeof(Agent))]
13+
[AddComponentMenu("ML Agents/Demonstration Recorder", (int) MenuGroup.Default)]
1314
public class DemonstrationRecorder : MonoBehaviour
1415
{
1516
public bool record;

UnitySDK/Assets/ML-Agents/Scripts/Policy/BehaviorParameters.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ namespace MLAgents
99
/// <summary>
1010
/// The Factory to generate policies.
1111
/// </summary>
12+
///
13+
[AddComponentMenu("ML Agents/Behavior Parameters", (int) MenuGroup.Default)]
1214
public class BehaviorParameters : MonoBehaviour
1315
{
1416

UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensorComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace MLAgents.Sensor
55
{
6+
[AddComponentMenu("ML Agents/Camera Sensor", (int) MenuGroup.Sensors)]
67
public class CameraSensorComponent : SensorComponent
78
{
89
public new Camera camera;

UnitySDK/Assets/ML-Agents/Scripts/Sensor/ISensor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,4 @@ public static int ObservationSize(this ISensor sensor)
7575
return count;
7676
}
7777
}
78-
7978
}

UnitySDK/Assets/ML-Agents/Scripts/Sensor/RayPerceptionSensorComponent2D.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
using UnityEngine;
2+
13
namespace MLAgents.Sensor
24
{
5+
[AddComponentMenu("ML Agents/Ray Perception Sensor 2D", (int) MenuGroup.Sensors)]
36
public class RayPerceptionSensorComponent2D : RayPerceptionSensorComponentBase
47
{
58
public override RayPerceptionSensor.CastType GetCastType()

UnitySDK/Assets/ML-Agents/Scripts/Sensor/RayPerceptionSensorComponent3D.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace MLAgents.Sensor
55
{
6+
[AddComponentMenu("ML Agents/Ray Perception Sensor 3D", (int) MenuGroup.Sensors)]
67
public class RayPerceptionSensorComponent3D : RayPerceptionSensorComponentBase
78
{
89
[Header("3D Properties", order = 100)]

UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensorComponent.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace MLAgents.Sensor
55
{
6+
[AddComponentMenu("ML Agents/Render Texture Sensor", (int) MenuGroup.Sensors)]
67
public class RenderTextureSensorComponent : SensorComponent
78
{
89
public RenderTexture renderTexture;

0 commit comments

Comments
 (0)