Skip to content

Remove macros for older unity versions which are no longer needed. #3168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions UnitySDK/Assets/ML-Agents/Editor/DemonstrationImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ public override void OnImportAsset(AssetImportContext ctx)
var texture = (Texture2D)
AssetDatabase.LoadAssetAtPath(k_IconPath, typeof(Texture2D));

#if UNITY_2017_3_OR_NEWER
ctx.AddObjectToAsset(ctx.assetPath, demonstration, texture);
ctx.SetMainObject(demonstration);
#else
ctx.SetMainAsset(ctx.assetPath, demonstration);
#endif
}
catch
{
Expand Down
7 changes: 0 additions & 7 deletions UnitySDK/Assets/ML-Agents/Editor/Tests/StandaloneBuildTest.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using UnityEditor;
using UnityEngine;
#if UNITY_2018_1_OR_NEWER
using UnityEditor.Build.Reporting;
#endif

namespace MLAgents
{
Expand All @@ -13,7 +11,6 @@ public static void BuildStandalonePlayerOSX()
{
string[] scenes = { "Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity" };
var buildResult = BuildPipeline.BuildPlayer(scenes, "testPlayer", BuildTarget.StandaloneOSX, BuildOptions.None);
#if UNITY_2018_1_OR_NEWER
var isOk = buildResult.summary.result == BuildResult.Succeeded;
var error = "";
foreach (var stepInfo in buildResult.steps)
Expand All @@ -26,10 +23,6 @@ public static void BuildStandalonePlayerOSX()
}
}
}
#else
var error = buildResult;
var isOk = string.IsNullOrEmpty(error);
#endif
if (isOk)
{
EditorApplication.Exit(0);
Expand Down
19 changes: 0 additions & 19 deletions UnitySDK/Assets/ML-Agents/Scripts/Grpc/RpcCommunicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,7 @@ UnityInputProto Initialize(UnityOutputProto unityOutput,
var result = m_Client.Exchange(WrapMessage(unityOutput, 200));
unityInput = m_Client.Exchange(WrapMessage(null, 200)).UnityInput;
#if UNITY_EDITOR
#if UNITY_2017_2_OR_NEWER
EditorApplication.playModeStateChanged += HandleOnPlayModeChanged;
#else
EditorApplication.playmodeStateChanged += HandleOnPlayModeChanged;
#endif
#endif
return result.UnityInput;
#else
Expand Down Expand Up @@ -525,7 +521,6 @@ public static void ProcessSideChannelData(Dictionary<int, SideChannel> sideChann
#endregion

#if UNITY_EDITOR
#if UNITY_2017_2_OR_NEWER
/// <summary>
/// When the editor exits, the communicator must be closed
/// </summary>
Expand All @@ -539,20 +534,6 @@ void HandleOnPlayModeChanged(PlayModeStateChange state)
}
}

#else
/// <summary>
/// When the editor exits, the communicator must be closed
/// </summary>
private void HandleOnPlayModeChanged()
{
// This method is run whenever the playmode state is changed.
if (!EditorApplication.isPlayingOrWillChangePlaymode)
{
Close();
}
}

#endif
#endif
}
}