Skip to content

Commit e2492f8

Browse files
author
Chris Elion
authored
build fixes for 2018+ (#2808)
* rename CompressionType enum * fix standalone build test for 2018+
1 parent fcd14a7 commit e2492f8

File tree

8 files changed

+43
-23
lines changed

8 files changed

+43
-23
lines changed

UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ public byte[] GetCompressedObservation()
9393
return null;
9494
}
9595

96-
public CompressionType GetCompressionType()
96+
public SensorCompressionType GetCompressionType()
9797
{
98-
return CompressionType.None;
98+
return SensorCompressionType.None;
9999
}
100100

101101
public string GetName()
Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using UnityEditor;
33
using UnityEngine;
4+
#if UNITY_2018_1_OR_NEWER
5+
using UnityEditor.Build.Reporting;
6+
#endif
47

58
namespace MLAgents
69
{
@@ -9,19 +12,37 @@ public class StandaloneBuildTest
912
static void BuildStandalonePlayerOSX()
1013
{
1114
string[] scenes = { "Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity" };
12-
var error = BuildPipeline.BuildPlayer(scenes, "testPlayer", BuildTarget.StandaloneOSX, BuildOptions.None);
13-
if (string.IsNullOrEmpty(error))
15+
var buildResult = BuildPipeline.BuildPlayer(scenes, "testPlayer", BuildTarget.StandaloneOSX, BuildOptions.None);
16+
#if UNITY_2018_1_OR_NEWER
17+
var isOK = buildResult.summary.result == BuildResult.Succeeded;
18+
var error = "";
19+
foreach (var stepInfo in buildResult.steps)
20+
{
21+
foreach (var msg in stepInfo.messages)
22+
{
23+
if (msg.type != LogType.Log && msg.type != LogType.Warning)
24+
{
25+
error += msg.content + "\n";
26+
}
27+
}
28+
}
29+
#else
30+
var error = buildResult;
31+
var isOK = string.IsNullOrEmpty(error);
32+
#endif
33+
if (isOK)
1434
{
1535
EditorApplication.Exit(0);
1636
}
1737
else
1838
{
1939
Console.Error.WriteLine(error);
2040
EditorApplication.Exit(1);
21-
41+
2242
}
2343
Debug.Log(error);
44+
2445
}
25-
46+
2647
}
2748
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public class AgentParameters
160160
/// of the environment extracts its current observation, sends them to its
161161
/// policy and in return receives an action. In practice,
162162
/// however, an agent need not send its observation at every step since very
163-
/// little may have changed between successive steps.
163+
/// little may have changed between successive steps.
164164
///
165165
/// At any step, an agent may be considered <see cref="m_Done"/>.
166166
/// This could occur due to a variety of reasons:
@@ -328,15 +328,15 @@ void OnDisable()
328328

329329
/// <summary>
330330
/// Updates the Model for the agent. Any model currently assigned to the
331-
/// agent will be replaced with the provided one. If the arguments are
331+
/// agent will be replaced with the provided one. If the arguments are
332332
/// identical to the current parameters of the agent, the model will
333-
/// remain unchanged.
333+
/// remain unchanged.
334334
/// </summary>
335-
/// <param name="behaviorName"> The identifier of the behavior. This
336-
/// will categorize the agent when training.
335+
/// <param name="behaviorName"> The identifier of the behavior. This
336+
/// will categorize the agent when training.
337337
/// </param>
338338
/// <param name="model"> The model to use for inference.</param>
339-
/// <param name = "inferenceDevide"> Define on what device the model
339+
/// <param name = "inferenceDevide"> Define on what device the model
340340
/// will be run.</param>
341341
public void GiveModel(
342342
string behaviorName,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public void WriteToTensor(TensorProxy tensorProxy, int agentIndex)
5555
}
5656
}
5757

58-
public CompressionType GetCompressionType()
58+
public SensorCompressionType GetCompressionType()
5959
{
60-
return CompressionType.PNG;
60+
return SensorCompressionType.PNG;
6161
}
6262

6363
/// <summary>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using MLAgents.InferenceBrain;
32
using UnityEngine;
43

54
namespace MLAgents.Sensor
@@ -14,7 +13,7 @@ public struct CompressedObservation
1413
/// <summary>
1514
/// The format of the compressed data
1615
/// </summary>
17-
public CompressionType CompressionType;
16+
public SensorCompressionType CompressionType;
1817

1918
/// <summary>
2019
/// The uncompressed dimensions of the data.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace MLAgents.Sensor
44
{
5-
public enum CompressionType
5+
public enum SensorCompressionType
66
{
77
None,
88
PNG,
@@ -38,10 +38,10 @@ public interface ISensor {
3838
byte[] GetCompressedObservation();
3939

4040
/// <summary>
41-
/// Return the compression type being used. If no compression is used, return CompressionType.None
41+
/// Return the compression type being used. If no compression is used, return SensorCompressionType.None
4242
/// </summary>
4343
/// <returns></returns>
44-
CompressionType GetCompressionType();
44+
SensorCompressionType GetCompressionType();
4545

4646
/// <summary>
4747
/// Get the name of the sensor. This is used to ensure deterministic sorting of the sensors on an Agent,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public void WriteToTensor(TensorProxy tensorProxy, int index)
5656
}
5757
}
5858

59-
public CompressionType GetCompressionType()
59+
public SensorCompressionType GetCompressionType()
6060
{
61-
return CompressionType.PNG;
61+
return SensorCompressionType.PNG;
6262
}
6363

6464
/// <summary>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public virtual byte[] GetCompressedObservation()
4646
return null;
4747
}
4848

49-
public virtual CompressionType GetCompressionType()
49+
public virtual SensorCompressionType GetCompressionType()
5050
{
51-
return CompressionType.None;
51+
return SensorCompressionType.None;
5252
}
5353
}
5454
}

0 commit comments

Comments
 (0)