浏览代码

Merge pull request #5167 from Unity-Technologies/MLA-1804-add-2021-tests

[MLA-1804] Update min version 2019.4, add 2021.1 tests
/develop/lex-walker-model
GitHub 4 年前
当前提交
63437f95
共有 49 个文件被更改,包括 206 次插入155 次删除
  1. 2
      .yamato/com.unity.ml-agents-pack.yml
  2. 13
      .yamato/com.unity.ml-agents-test.yml
  3. 6
      .yamato/test_versions.metafile
  4. 13
      DevProject/Packages/manifest.json
  5. 49
      DevProject/Packages/packages-lock.json
  6. 4
      DevProject/ProjectSettings/EditorBuildSettings.asset
  7. 4
      DevProject/ProjectSettings/ProjectVersion.txt
  8. 7
      Project/Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBall.demo.meta
  9. 7
      Project/Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBallHard.demo.meta
  10. 7
      Project/Assets/ML-Agents/Examples/Basic/Demos/ExpertBasic.demo.meta
  11. 7
      Project/Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawler.demo.meta
  12. 7
      Project/Assets/ML-Agents/Examples/GridWorld/Demos/ExpertGridWorld.demo.meta
  13. 7
      Project/Assets/ML-Agents/Examples/Hallway/Demos/ExpertHallway.demo.meta
  14. 7
      Project/Assets/ML-Agents/Examples/PushBlock/Demos/ExpertPushBlock.demo.meta
  15. 7
      Project/Assets/ML-Agents/Examples/Pyramids/Demos/ExpertPyramid.demo.meta
  16. 7
      Project/Assets/ML-Agents/Examples/Walker/Demos/ExpertWalker.demo.meta
  17. 21
      Project/Packages/manifest.json
  18. 16
      Project/ProjectSettings/EditorSettings.asset
  19. 3
      Project/ProjectSettings/ProjectVersion.txt
  20. 12
      com.unity.ml-agents.extensions/Documentation~/com.unity.ml-agents.extensions.md
  21. 4
      com.unity.ml-agents.extensions/Editor/Input/InputActuatorComponentEditor.cs
  22. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs
  23. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/DoubleInputActionAdaptor.cs
  24. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/FloatInputActionAdaptor.cs
  25. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/IntegerInputActionAdaptor.cs
  26. 4
      com.unity.ml-agents.extensions/Runtime/Input/Adaptors/Vector2InputActionAdaptor.cs
  27. 4
      com.unity.ml-agents.extensions/Runtime/Input/IInputActionAssetProvider.cs
  28. 4
      com.unity.ml-agents.extensions/Runtime/Input/IRLActionInputAdaptor.cs
  29. 4
      com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs
  30. 4
      com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs
  31. 4
      com.unity.ml-agents.extensions/Runtime/Input/InputActuatorEventContext.cs
  32. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/ButtonInputActionAdaptorTests.cs
  33. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/DoubleInputActionAdaptorTests.cs
  34. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/FloatInputActionAdapatorTests.cs
  35. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/IntegerInputActionAdaptorTests.cs
  36. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/Vector2InputActionAdaptorTests.cs
  37. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/InputActionActuatorTests.cs
  38. 4
      com.unity.ml-agents.extensions/Tests/Runtime/Input/TestPushBlockActions.cs
  39. 2
      com.unity.ml-agents.extensions/package.json
  40. 1
      com.unity.ml-agents/CHANGELOG.md
  41. 2
      com.unity.ml-agents/Documentation~/com.unity.ml-agents.md
  42. 6
      com.unity.ml-agents/Editor/MLAgentsSettingsBuildProvider.cs
  43. 4
      com.unity.ml-agents/Editor/MLAgentsSettingsProvider.cs
  44. 22
      com.unity.ml-agents/Runtime/Analytics/InferenceAnalytics.cs
  45. 26
      com.unity.ml-agents/Runtime/Analytics/TrainingAnalytics.cs
  46. 6
      com.unity.ml-agents/Tests/Editor/AcademyTests.cs
  47. 2
      com.unity.ml-agents/package.json
  48. 9
      docs/Installation.md
  49. 3
      docs/Migrating.md

2
.yamato/com.unity.ml-agents-pack.yml


commands:
- |
python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
unity-downloader-cli -u 2018.4 -c editor --wait --fast
unity-downloader-cli -u 2019.4 -c editor --wait --fast
./.Editor/Unity -projectPath Project -batchMode -executeMethod Unity.MLAgents.SampleExporter.ExportCuratedSamples -logFile -
npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
upm-ci project pack --project-path Project

13
.yamato/com.unity.ml-agents-test.yml


test_editors:
- version: 2018.4
# 2018.4 doesn't support code-coverage
enableCodeCoverage: !!bool false
# We want some scene tests to run in the DevProject, but packages there only support 2019+
- version: 2019.4
enableCodeCoverage: !!bool true
# We want some scene tests to run in the DevProject, but packages there only support 2020+
enableNoDefaultPackages: !!bool false
- version: 2019.4
enableNoDefaultPackages: !!bool true
- version: 2020.2
- version: 2020.2
- version: 2021.1
enableCodeCoverage: !!bool true
testProject: DevProject
enableNoDefaultPackages: !!bool true

6
.yamato/test_versions.metafile


# For each "other" test, we only run it against a single version of the
# editor to reduce the number of yamato jobs
test_editors:
- version: 2018.4
extra_test: llapi
- version: 2020.2
- version: 2020.3
- version: 2021.1
extra_test: llapi

13
DevProject/Packages/manifest.json


"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "3.6.1",
"com.unity.analytics": "3.3.5",
"com.unity.analytics": "3.5.3",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.collab-proxy": "1.3.9",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.7",
"com.unity.ide.vscode": "1.2.3",
"com.unity.inputsystem": "1.1.0-preview.3",
"com.unity.ml-agents": "file:../../com.unity.ml-agents",

"com.unity.package-validation-suite": "0.19.0-preview",
"com.unity.purchasing": "2.2.1",
"com.unity.purchasing": "2.2.2",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.12",
"com.unity.textmeshpro": "3.0.1",
"com.unity.timeline": "1.4.6",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.1.7",
"com.unity.modules.ai": "1.0.0",

49
DevProject/Packages/packages-lock.json


"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.analytics": {
"version": "3.3.5",
"version": "3.5.3",
"depth": 0,
"source": "registry",
"dependencies": {

},
"com.unity.barracuda": {
"version": "1.3.1-preview",
"version": "1.3.2-preview",
"depth": 1,
"source": "registry",
"dependencies": {

"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.collab-proxy": {
"version": "1.2.16",
"version": "1.3.9",
"depth": 0,
"source": "registry",
"dependencies": {},

"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.ide.rider": {
"version": "1.1.4",
"version": "2.0.7",
"depth": 0,
"source": "registry",
"dependencies": {

},
"com.unity.ide.visualstudio": {
"version": "2.0.7",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.test-framework": "1.1.9"
},
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.ide.vscode": {
"version": "1.2.3",
"depth": 0,

"depth": 0,
"source": "local",
"dependencies": {
"com.unity.barracuda": "1.3.1-preview",
"com.unity.barracuda": "1.3.2-preview",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0"
"com.unity.modules.physics2d": "1.0.0"
}
},
"com.unity.ml-agents.extensions": {

"dependencies": {
"com.unity.ml-agents": "1.8.0-preview"
"com.unity.ml-agents": "2.0.0-exp.1"
}
},
"com.unity.multiplayer-hlapi": {

"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.purchasing": {
"version": "2.2.1",
"version": "2.2.2",
"depth": 0,
"source": "registry",
"dependencies": {

"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.textmeshpro": {
"version": "2.0.1",
"version": "3.0.1",
"depth": 0,
"source": "registry",
"dependencies": {

},
"com.unity.timeline": {
"version": "1.2.12",
"version": "1.4.6",
"dependencies": {},
"dependencies": {
"com.unity.modules.director": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.ugui": {

"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.uielementsnative": "1.0.0"
}
},
"com.unity.modules.uielementsnative": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
}

4
DevProject/ProjectSettings/EditorBuildSettings.asset


- enabled: 1
path: Assets/ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTestScene.unity
guid: 9bafc50b1e55b43b2b1ae9620f1f8311
m_configObjects: {}
m_configObjects:
com.unity.ml-agents.settings: {fileID: 11400000, guid: 7017f4eb06bef4889a3608a54b1cc59e,
type: 2}

4
DevProject/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.4.20f1
m_EditorVersionWithRevision: 2019.4.20f1 (6dd1c08eedfa)
m_EditorVersion: 2020.3.0f1
m_EditorVersionWithRevision: 2020.3.0f1 (c7b5465681fb)

7
Project/Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBall.demo.meta


fileFormatVersion: 2
guid: bbf6756da134740eaa002a1b84f655cb
ScriptedImporter:
fileIDToRecycleName:
11400000: Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBall.demo
internalIDToNameTable:
- first:
114: 11400000
second: Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBall.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBallHard.demo.meta


fileFormatVersion: 2
guid: 6942431e411b146be9a597663eca89af
ScriptedImporter:
fileIDToRecycleName:
11400000: Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBallHard.demo
internalIDToNameTable:
- first:
114: 11400000
second: Assets/ML-Agents/Examples/3DBall/Demos/Expert3DBallHard.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/Basic/Demos/ExpertBasic.demo.meta


fileFormatVersion: 2
guid: 414224ce8b3e247ad936b17f574b10ab
ScriptedImporter:
fileIDToRecycleName:
11400000: Assets/ML-Agents/Examples/Basic/Demos/ExpertBasic.demo
internalIDToNameTable:
- first:
114: 11400000
second: Assets/ML-Agents/Examples/Basic/Demos/ExpertBasic.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawler.demo.meta


fileFormatVersion: 2
guid: 34586a8d0f1c342a49973b36a609e73b
ScriptedImporter:
fileIDToRecycleName:
11400002: Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawler.demo
internalIDToNameTable:
- first:
114: 11400002
second: Assets/ML-Agents/Examples/Crawler/Demos/ExpertCrawler.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/GridWorld/Demos/ExpertGridWorld.demo.meta


fileFormatVersion: 2
guid: 0092f2e4aece345aea4730a37eeebf68
ScriptedImporter:
fileIDToRecycleName:
11400002: Assets/ML-Agents/Examples/GridWorld/Demos/ExpertGridWorld.demo
internalIDToNameTable:
- first:
114: 11400002
second: Assets/ML-Agents/Examples/GridWorld/Demos/ExpertGridWorld.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/Hallway/Demos/ExpertHallway.demo.meta


fileFormatVersion: 2
guid: 41c6af18564fe425fa1c047d603ee34e
ScriptedImporter:
fileIDToRecycleName:
11400000: Assets/ML-Agents/Examples/Hallway/Demos/ExpertHallway.demo
internalIDToNameTable:
- first:
114: 11400000
second: Assets/ML-Agents/Examples/Hallway/Demos/ExpertHallway.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/PushBlock/Demos/ExpertPushBlock.demo.meta


fileFormatVersion: 2
guid: 7f11f35191533404c9957443a681aaee
ScriptedImporter:
fileIDToRecycleName:
11400002: Assets/ML-Agents/Examples/PushBlock/Demos/ExpertPushBlock.demo
internalIDToNameTable:
- first:
114: 11400002
second: Assets/ML-Agents/Examples/PushBlock/Demos/ExpertPushBlock.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/Pyramids/Demos/ExpertPyramid.demo.meta


fileFormatVersion: 2
guid: 2f9d53c90f11846d7a6499ce0f1dfebb
ScriptedImporter:
fileIDToRecycleName:
11400000: Assets/ML-Agents/Examples/Pyramids/Demos/ExpertPyramid.demo
internalIDToNameTable:
- first:
114: 11400000
second: Assets/ML-Agents/Examples/Pyramids/Demos/ExpertPyramid.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/Walker/Demos/ExpertWalker.demo.meta


fileFormatVersion: 2
guid: a4b02e2c382c247919eb63ce72e90a3b
ScriptedImporter:
fileIDToRecycleName:
11400002: Assets/ML-Agents/Examples/Walker/Demos/ExpertWalker.demo
internalIDToNameTable:
- first:
114: 11400002
second: Assets/ML-Agents/Examples/Walker/Demos/ExpertWalker.demo
serializedVersion: 2
userData: ' (Unity.MLAgents.Demonstrations.DemonstrationSummary)'
assetBundleName:
assetBundleVariant:

21
Project/Packages/manifest.json


{
"dependencies": {
"com.unity.ads": "2.0.8",
"com.unity.collab-proxy": "1.2.15",
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "3.6.1",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.3",
"com.unity.package-manager-ui": "2.0.13",
"com.unity.textmeshpro": "1.4.1",
"com.unity.multiplayer-hlapi": "1.0.8",
"com.unity.nuget.newtonsoft-json": "2.0.0",
"com.unity.test-framework": "1.1.22",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.6",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.1.7",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",

"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0",
"com.unity.nuget.newtonsoft-json": "2.0.0"
"com.unity.modules.xr": "1.0.0"
},
"testables": [
"com.unity.ml-agents",

16
Project/ProjectSettings/EditorSettings.asset


--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 7
serializedVersion: 9
m_ExternalVersionControlSupport: Hidden Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 1

m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref
m_EnableTextureStreamingInEditMode: 1
m_AsyncShaderCompilation: 1
m_EnterPlayModeOptionsEnabled: 0
m_EnterPlayModeOptions: 3
m_ShowLightmapResolutionOverlay: 1
m_UseLegacyProbeSampleCount: 1
m_AssetPipelineMode: 1
m_CacheServerMode: 0
m_CacheServerEndpoint:
m_CacheServerNamespacePrefix: default
m_CacheServerEnableDownload: 1
m_CacheServerEnableUpload: 1

3
Project/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2018.4.32f1
m_EditorVersion: 2019.4.20f1
m_EditorVersionWithRevision: 2019.4.20f1 (6dd1c08eedfa)

12
com.unity.ml-agents.extensions/Documentation~/com.unity.ml-agents.extensions.md


## Requirements
This version of the Unity ML-Agents Extensions package is compatible with the
following versions of the Unity Editor:
This version of the Unity ML-Agents package is compatible with the following
versions of the Unity Editor:
- If using the `InputActuatorComponent`
- 2019.4 or later
- install the `com.unity.inputsystem` package version `1.1.0-preview.3` or later.
- Else 2018.4 and later
- 2019.4 and later
If using the `InputActuatorComponent`
- install the `com.unity.inputsystem` package version `1.1.0-preview.3` or later.
## Known Limitations
- For the `InputActuatorComponent`

4
com.unity.ml-agents.extensions/Editor/Input/InputActuatorComponentEditor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Extensions.Input;
using UnityEditor;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine;
using UnityEngine.InputSystem;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/DoubleInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/FloatInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/IntegerInputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/Adaptors/Vector2InputActionAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using Unity.MLAgents.Actuators;
using UnityEngine;

}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/IInputActionAssetProvider.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using UnityEngine.InputSystem;
namespace Unity.MLAgents.Extensions.Input

(InputActionAsset, IInputActionCollection2) GetInputActionAsset();
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/IRLActionInputAdaptor.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using Unity.MLAgents.Actuators;
using UnityEngine.InputSystem;

void WriteToHeuristic(InputAction action, in ActionBuffers actionBuffers);
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Policies;

}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using System.Collections.Generic;
using Unity.Collections;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Runtime/Input/InputActuatorEventContext.cs


#if MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_SYSTEM
using System;
using Unity.Collections;
using UnityEngine.InputSystem;

}
}
}
#endif // MLA_INPUT_SYSTEM && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_SYSTEM

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/ButtonInputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/DoubleInputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/FloatInputActionAdapatorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/IntegerInputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using System;
using NUnit.Framework;
using Unity.MLAgents.Actuators;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/Adaptors/Vector2InputActionAdaptorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Extensions.Input;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/InputActionActuatorTests.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
using NUnit.Framework;
using Unity.Barracuda;
using Unity.MLAgents.Actuators;

}
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

4
com.unity.ml-agents.extensions/Tests/Runtime/Input/TestPushBlockActions.cs


#if MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#if MLA_INPUT_TESTS
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator

void OnJump(InputAction.CallbackContext context);
}
}
#endif // MLA_INPUT_TESTS && UNITY_2019_4_OR_NEWER
#endif // MLA_INPUT_TESTS

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


"name": "com.unity.ml-agents.extensions",
"displayName": "ML Agents Extensions",
"version": "0.3.0-preview",
"unity": "2018.4",
"unity": "2019.4",
"description": "A source-only package for new features based on ML-Agents",
"dependencies": {
"com.unity.ml-agents": "2.0.0-exp.1"

1
com.unity.ml-agents/CHANGELOG.md


## [Unreleased]
### Major Changes
#### com.unity.ml-agents (C#)
- The minimum supported Unity version was updated to 2019.4. (#5166)
- Several breaking interface changes were made. See the
[Migration Guide](https://github.com/Unity-Technologies/ml-agents/blob/release_14_docs/docs/Migrating.md) for more
details.

2
com.unity.ml-agents/Documentation~/com.unity.ml-agents.md


This version of the Unity ML-Agents package is compatible with the following
versions of the Unity Editor:
- 2018.4 and later
- 2019.4 and later
## Known Limitations

6
com.unity.ml-agents/Editor/MLAgentsSettingsBuildProvider.cs


private static bool IsPlayerSettingsDirty()
{
#if UNITY_2019_OR_NEWER
#else
return false;
#endif
#if UNITY_2019_OR_NEWER
#endif
}
}
}

4
com.unity.ml-agents/Editor/MLAgentsSettingsProvider.cs


using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEditor;
#if UNITY_2019_4_OR_NEWER
#else
using UnityEngine.Experimental.UIElements;
#endif
[assembly: InternalsVisibleTo("Unity.ML-Agents.DevTests.Editor")]
namespace Unity.MLAgents.Editor

22
com.unity.ml-agents/Runtime/Analytics/InferenceAnalytics.cs


#if MLA_UNITY_ANALYTICS_MODULE || !UNITY_2019_4_OR_NEWER
#define MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Unity.Barracuda;

using Unity.MLAgents.Sensors;
using UnityEngine;
#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
using UnityEngine.Analytics;
#endif

#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
#endif // MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif // MLA_UNITY_ANALYTICS_MODULE
#endif // UNITY_EDITOR

return true;
}
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
#elif MLA_UNITY_ANALYTICS_MODULE_ENABLED
#elif MLA_UNITY_ANALYTICS_MODULE
AnalyticsResult result = AnalyticsResult.UnsupportedPlatform;
if (result == AnalyticsResult.Ok)
{

/// <param name="actionSpec">ActionSpec for the Agent. Used to generate information about the action space.</param>
/// <param name="actuators">List of IActuators for the Agent. Used to generate information about the action space.</param>
/// <returns></returns>
[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void InferenceModelSet(
NNModel nnModel,
string behaviorName,

var data = GetEventForModel(nnModel, behaviorName, inferenceDevice, sensors, actionSpec, actuators);
// Note - to debug, use JsonUtility.ToJson on the event.
// Debug.Log(JsonUtility.ToJson(data, true));
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_EventName, data, k_EventVersion);

inferenceEvent.BarracudaModelProducer = "tensorflow_to_barracuda.py";
}
#if UNITY_2019_3_OR_NEWER && UNITY_EDITOR
#if UNITY_EDITOR
var barracudaPackageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(Tensor).Assembly);
inferenceEvent.BarracudaPackageVersion = barracudaPackageInfo.version;
#else

26
com.unity.ml-agents/Runtime/Analytics/TrainingAnalytics.cs


#if MLA_UNITY_ANALYTICS_MODULE || !UNITY_2019_4_OR_NEWER
#define MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif
using System;
using System.Collections.Generic;
using System.Diagnostics;

#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
using UnityEngine.Analytics;
#if UNITY_EDITOR
using UnityEditor.Analytics;

static bool EnableAnalytics()
{
#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if MLA_UNITY_ANALYTICS_MODULE
if (s_EventsRegistered)
{
return true;

return s_EventsRegistered;
#else
return false;
#endif // MLA_UNITY_ANALYTICS_MODULE_ENABLED
#endif // MLA_UNITY_ANALYTICS_MODULE
}
/// <summary>

/// <param name="packageVersion"></param>
[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void SetTrainerInformation(string packageVersion, string communicationVersion)
{
s_TrainerPackageVersion = packageVersion;

public static bool IsAnalyticsEnabled()
{
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
return EditorAnalytics.enabled;
#else
return false;

[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void TrainingEnvironmentInitialized(TrainingEnvironmentInitializedEvent tbiEvent)
{
if (!IsAnalyticsEnabled())

// Debug.Log(
// $"Would send event {k_TrainingEnvironmentInitializedEventName} with body {JsonUtility.ToJson(tbiEvent, true)}"
// );
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_TrainingEnvironmentInitializedEventName, tbiEvent);

[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void RemotePolicyInitialized(
string fullyQualifiedBehaviorName,
IList<ISensor> sensors,

// Debug.Log(
// $"Would send event {k_RemotePolicyInitializedEventName} with body {JsonUtility.ToJson(data, true)}"
// );
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_RemotePolicyInitializedEventName, data);

return fullyQualifiedBehaviorName.Substring(0, lastQuestionIndex);
}
[Conditional("MLA_UNITY_ANALYTICS_MODULE_ENABLED")]
[Conditional("MLA_UNITY_ANALYTICS_MODULE")]
public static void TrainingBehaviorInitialized(TrainingBehaviorInitializedEvent tbiEvent)
{
if (!IsAnalyticsEnabled())

// Debug.Log(
// $"Would send event {k_TrainingBehaviorInitializedEventName} with body {JsonUtility.ToJson(tbiEvent, true)}"
// );
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE_ENABLED
#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
if (AnalyticsUtils.s_SendEditorAnalytics)
{
EditorAnalytics.SendEventWithLimit(k_TrainingBehaviorInitializedEventName, tbiEvent);

6
com.unity.ml-agents/Tests/Editor/AcademyTests.cs


using NUnit.Framework;
using Unity.MLAgents.Sensors;
using UnityEngine;
#if UNITY_2019_3_OR_NEWER
#endif
namespace Unity.MLAgents.Tests
{

[Test]
public void TestPackageVersion()
{
// Make sure that the version strings in the package and Academy don't get out of sync.
// Unfortunately, the PackageInfo methods don't exist in earlier versions of the editor.
#if UNITY_2019_3_OR_NEWER
#endif
}
class RecursiveAgent : Agent

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


"name": "com.unity.ml-agents",
"displayName": "ML Agents",
"version": "2.0.0-exp.1",
"unity": "2018.4",
"unity": "2019.4",
"description": "Use state-of-the-art machine learning to create intelligent character behaviors in any Unity environment (games, robotics, film, etc.).",
"dependencies": {
"com.unity.barracuda": "1.3.2-preview",

9
docs/Installation.md


Consequently, to install and use the ML-Agents Toolkit you will need to:
- Install Unity (2018.4 or later)
- Install Unity (2019.4 or later)
- Install Python (3.6.1 or higher)
- Clone this repository (Optional)
- __Note:__ If you do not clone the repository, then you will not be

- Install the `com.unity.ml-agents.extensions` Unity package (Optional)
- Install the `mlagents` Python package
### Install **Unity 2018.4** or Later
### Install **Unity 2019.4** or Later
[Download](https://unity3d.com/get-unity/download) and install Unity. We
strongly recommend that you install Unity through the Unity Hub as it will

project by:
1. navigating to the menu `Window` -> `Package Manager`.
1. In the package manager window click on the `+` button.
1. In the package manager window click on the `+` button on the top left of the packages list).
**NOTE:** In Unity 2018.4 the `+` button is on the bottom right of the packages
list, and in Unity 2019.3 it's on the top left of the packages list.
<p align="center">
<img src="images/unity_package_manager_window.png"

3
docs/Migrating.md


# Migrating
## Migrating the package to version 2.0
- The official version of Unity ML-Agents supports is now 2019.4 LTS. If you run
into issues, please consider deleting your project's Library folder and reponening your
project.
- If you used any of the APIs that were deprecated before version 2.0, you need to use their replacement. These deprecated APIs have been removed. See the migration steps bellow for specific API replacements.
### IDiscreteActionMask changes
- The interface for disabling specific discrete actions has changed. `IDiscreteActionMask.WriteMask()` was removed,

正在加载...
取消
保存