Skip to content

Commit 316b6d6

Browse files
Nit to core package, update package manifest, update build provider to address this bug: https://unity.slack.com/archives/C8FECS6L9/p1669646048318809 (#5841)
1 parent 6bb711f commit 316b6d6

File tree

7 files changed

+12
-47
lines changed

7 files changed

+12
-47
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ test_platforms:
2121
- name: mac
2222
type: Unity::VM::osx
2323
image: package-ci/mac:stable
24-
flavor: b1.small
24+
flavor: b1.large
2525
- name: linux
2626
type: Unity::VM
2727
image: ml-agents/ml-agents-ubuntu-18.04:latest
28-
flavor: b1.medium
28+
flavor: b1.large
2929

3030
packages:
3131
- name: com.unity.ml-agents

DevProject/Packages/packages-lock.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"depth": 0,
6868
"source": "local",
6969
"dependencies": {
70-
"com.unity.ml-agents": "2.2.1-exp.1",
70+
"com.unity.ml-agents": "2.3.0-exp.4",
7171
"com.unity.modules.physics": "1.0.0"
7272
}
7373
},

DevProject/ProjectSettings/EditorBuildSettings.asset

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ EditorBuildSettings:
99
path: Assets/ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTestScene.unity
1010
guid: 9bafc50b1e55b43b2b1ae9620f1f8311
1111
m_configObjects:
12-
com.unity.ml-agents.settings: {fileID: 11400000, guid: 905d6ca857fdf4d028b93658cf00e271,
12+
com.unity.ml-agents.settings: {fileID: 11400000, guid: b412e5eb0b23f4bca86655ada9a633d4,
1313
type: 2}

Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ public class JointDriveController : MonoBehaviour
108108

109109
public float jointDampen;
110110
public float maxJointForceLimit;
111-
float m_FacingDot;
112111

113112
[HideInInspector] public Dictionary<Transform, BodyPart> bodyPartsDict = new Dictionary<Transform, BodyPart>();
114113

Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ public class TargetController : MonoBehaviour
1414
{
1515

1616
[Header("Collider Tag To Detect")]
17-
public string tagToDetect = "agent"; //collider tag to detect
17+
public string tagToDetect = "agent"; //collider tag to detect
1818

1919
[Header("Target Placement")]
2020
public float spawnRadius; //The radius in which a target can be randomly spawned.
2121
public bool respawnIfTouched; //Should the target respawn to a different position when touched
2222

2323
[Header("Target Fell Protection")]
2424
public bool respawnIfFallsOffPlatform = true; //If the target falls off the platform, reset the position.
25-
public float fallDistance = 5; //distance below the starting height that will trigger a respawn
26-
25+
public float fallDistance = 5; //distance below the starting height that will trigger a respawn
2726

2827
private Vector3 m_startingPos; //the starting position of the target
29-
private Agent m_agentTouching; //the agent currently touching the target
3028

3129
[System.Serializable]
3230
public class TriggerEvent : UnityEvent<Collider>

Project/Packages/packages-lock.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"depth": 0,
6666
"source": "local",
6767
"dependencies": {
68-
"com.unity.ml-agents": "2.2.1-exp.1",
68+
"com.unity.ml-agents": "2.3.0-exp.4",
6969
"com.unity.modules.physics": "1.0.0"
7070
}
7171
},

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

+5-37
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,29 @@ namespace Unity.MLAgents.Editor
99
{
1010
internal class MLAgentsSettingsBuildProvider : IPreprocessBuildWithReport, IPostprocessBuildWithReport
1111
{
12-
private MLAgentsSettings m_SettingsAddedToPreloadedAssets;
13-
1412
public int callbackOrder => 0;
1513

1614
public void OnPreprocessBuild(BuildReport report)
1715
{
18-
var wasDirty = IsPlayerSettingsDirty();
19-
m_SettingsAddedToPreloadedAssets = null;
16+
if (!EditorUtility.IsPersistent(MLAgentsSettingsManager.Settings))
17+
return;
2018

2119
var preloadedAssets = PlayerSettings.GetPreloadedAssets().ToList();
2220
if (!preloadedAssets.Contains(MLAgentsSettingsManager.Settings))
2321
{
24-
m_SettingsAddedToPreloadedAssets = MLAgentsSettingsManager.Settings;
25-
preloadedAssets.Add(m_SettingsAddedToPreloadedAssets);
22+
preloadedAssets.Add(MLAgentsSettingsManager.Settings);
2623
PlayerSettings.SetPreloadedAssets(preloadedAssets.ToArray());
2724
}
28-
29-
if (!wasDirty)
30-
ClearPlayerSettingsDirtyFlag();
3125
}
3226

3327
public void OnPostprocessBuild(BuildReport report)
3428
{
35-
if (m_SettingsAddedToPreloadedAssets == null)
36-
return;
37-
38-
var wasDirty = IsPlayerSettingsDirty();
39-
4029
var preloadedAssets = PlayerSettings.GetPreloadedAssets().ToList();
41-
if (preloadedAssets.Contains(m_SettingsAddedToPreloadedAssets))
30+
if (preloadedAssets.Contains(MLAgentsSettingsManager.Settings))
4231
{
43-
preloadedAssets.Remove(m_SettingsAddedToPreloadedAssets);
32+
preloadedAssets.Remove(MLAgentsSettingsManager.Settings);
4433
PlayerSettings.SetPreloadedAssets(preloadedAssets.ToArray());
4534
}
46-
47-
m_SettingsAddedToPreloadedAssets = null;
48-
49-
if (!wasDirty)
50-
ClearPlayerSettingsDirtyFlag();
51-
}
52-
53-
54-
private static bool IsPlayerSettingsDirty()
55-
{
56-
var settings = Resources.FindObjectsOfTypeAll<PlayerSettings>();
57-
if (settings != null && settings.Length > 0)
58-
return EditorUtility.IsDirty(settings[0]);
59-
return false;
60-
}
61-
62-
private static void ClearPlayerSettingsDirtyFlag()
63-
{
64-
var settings = Resources.FindObjectsOfTypeAll<PlayerSettings>();
65-
if (settings != null && settings.Length > 0)
66-
EditorUtility.ClearDirty(settings[0]);
6735
}
6836
}
6937
}

0 commit comments

Comments
 (0)