Skip to content

Commit b4e832f

Browse files
committed
Cleanup defines. Address PR feedback.
1 parent 9471826 commit b4e832f

File tree

9 files changed

+24
-31
lines changed

9 files changed

+24
-31
lines changed

.yamato/com.unity.ml-agents-coverage.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
test_editors:
2-
- version: 2019.4
2+
- version: 2020.2
33
testProject: DevProject
44

55
test_platforms:
6-
- name: win
7-
type: Unity::VM
8-
image: package-ci/win10:stable
9-
flavor: b1.large
10-
- name: mac
11-
type: Unity::VM::osx
12-
image: package-ci/mac:stable
13-
flavor: b1.small
146
- name: linux
157
type: Unity::VM
168
image: package-ci/ubuntu:stable

.yamato/com.unity.ml-agents-optional-dep-tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
optional_deps:
22
- name: Analytics
33
project: "OptionalDepedencyTests/NoAnalyticsModule"
4-
version: 2019.4
4+
version: 2020.2
55
- name: Physics
66
project: OptionalDepedencyTests/NoPhysicsModule
7-
version: 2019.4
7+
version: 2020.2
88
- name: Physics2D
99
project: OptionalDepedencyTests/NoPhysics2DModule
10-
version: 2019.4
10+
version: 2020.2
1111
---
1212

1313
{% for optional_dep in optional_deps %}
@@ -46,8 +46,8 @@ OptionalDependencyTests_{{ optional_dep.name }}:
4646
- "upm-ci~/test-results/**/*"
4747
dependencies:
4848
- .yamato/com.unity.ml-agents-pack.yml#pack
49-
- .yamato/com.unity.ml-agents-coverage.yml#test_coverage_com.unity.ml-agents_linux_2019.4
50-
- .yamato/com.unity.ml-agents-coverage.yml#test_coverage_com.unity.ml-agents.extensions_linux_2019.4
49+
- .yamato/com.unity.ml-agents-coverage.yml#test_coverage_com.unity.ml-agents_linux_{{ optional_dep.version }}
50+
- .yamato/com.unity.ml-agents-coverage.yml#test_coverage_com.unity.ml-agents.extensions_linux_{{ optional_dep.version }}
5151
triggers:
5252
cancel_old_ci: true
5353
expression: |

com.unity.ml-agents.extensions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"unity": "2018.4",
66
"description": "A source-only package for new features based on ML-Agents",
77
"dependencies": {
8-
"com.unity.ml-agents": "2.0.0-exp.1"
8+
"com.unity.ml-agents": "2.0.0-exp.1",
99
"com.unity.modules.physics": "1.0.0"
1010
}
1111
}

com.unity.ml-agents/Runtime/Analytics/AnalyticsUtils.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#if MLA_UNITY_ANALYTICS_MODULE || !UNITY_2019_4_OR_NEWER
2-
#define MLA_UNITY_ANALYTICS_MODULE_ENABLED
3-
#endif
4-
51
using System;
62
using UnityEngine;
73

com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#if MLA_UNITY_ANALYTICS_MODULE || !UNITY_2019_4_OR_NEWER
2-
#define MLA_UNITY_ANALYTICS_MODULE_ENABLED
3-
#endif
4-
51
using System;
62
using System.Collections.Generic;
73
using System.Linq;

com.unity.ml-agents/Runtime/Policies/BarracudaPolicy.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ string behaviorName
7878
/// <inheritdoc />
7979
public void RequestDecision(AgentInfo info, List<ISensor> sensors)
8080
{
81-
#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
8281
if (!m_AnalyticsSent)
8382
{
8483
m_AnalyticsSent = true;
@@ -91,7 +90,6 @@ public void RequestDecision(AgentInfo info, List<ISensor> sensors)
9190
m_Actuators
9291
);
9392
}
94-
#endif
9593
m_AgentId = info.episodeId;
9694
m_ModelRunner?.PutObservations(info, sensors);
9795
}

com.unity.ml-agents/Runtime/Sensors/RayPerceptionSensorComponentBase.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,8 @@ public float RayLength
105105
set { m_RayLength = value; UpdateSensor(); }
106106
}
107107

108-
#if MLA_UNITY_PHYSICS_MODULE_ENABLED
109-
const int k_PhysicsDefaultLayers = Physics.DefaultRaycastLayers;
110-
#elif MLA_UNITY_PHYSICS2D_MODULE_ENABLED
111-
const int k_PhysicsDefaultLayers = Physics2D.DefaultRaycastLayers;
112-
#else
113108
// The value of the default layers.
114109
const int k_PhysicsDefaultLayers = -5;
115-
#endif
116110
[HideInInspector, SerializeField, FormerlySerializedAs("rayLayerMask")]
117111
[Tooltip("Controls which layers the rays can hit.")]
118112
LayerMask m_RayLayerMask = k_PhysicsDefaultLayers;

com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections;
3+
using System.Collections.Generic;
34
using UnityEngine;
45
using NUnit.Framework;
56
using System.Reflection;
@@ -130,6 +131,11 @@ public int[] GetObservationShape()
130131
return new[] { 0 };
131132
}
132133

134+
public ObservationSpec GetObservationSpec()
135+
{
136+
return ObservationSpec.Vector(0);
137+
}
138+
133139
public int Write(ObservationWriter writer)
134140
{
135141
numWriteCalls++;

com.unity.ml-agents/Tests/Runtime/Sensor/RayPerceptionSensorTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ public void TestGetRayAngles()
3232

3333
public class RayPerception3DTests
3434
{
35+
[Test]
36+
public void TestDefaultLayersAreNegativeFive()
37+
{
38+
#if MLA_UNITY_PHYSICS_MODULE_ENABLED
39+
Assert.IsTrue(Physics.DefaultRaycastLayers == -5);
40+
#endif
41+
#if MLA_UNITY_PHYSICS2D_MODULE_ENABLED
42+
Assert.IsTrue(Physics2D.DefaultRaycastLayers == -5);
43+
#endif
44+
}
45+
3546
#if MLA_UNITY_PHYSICS_MODULE_ENABLED
3647
// Use built-in tags
3748
const string k_CubeTag = "Player";

0 commit comments

Comments
 (0)