-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up AcademyFixedUpdateStepper when playmode changed (#4532)
* Destroy stepper when playmode change * Detroy stepper if it does not belong to the current Academy Co-authored-by: Chris Elion <chris.elion@unity3d.com>
- Loading branch information
1 parent
a261b40
commit 23c1ffc
Showing
19 changed files
with
548 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
DevProject/Assets/ML-Agents/Scripts/Tests/Runtime/AcademyTest.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
DevProject/Assets/ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections; | ||
using NUnit.Framework; | ||
using UnityEngine.TestTools; | ||
using UnityEngine; | ||
using UnityEngine.SceneManagement; | ||
using Unity.MLAgents; | ||
#if UNITY_EDITOR | ||
using UnityEditor.SceneManagement; | ||
#endif | ||
|
||
namespace Tests | ||
{ | ||
public class AcademyStepperTest | ||
{ | ||
[SetUp] | ||
public void Setup() | ||
{ | ||
SceneManager.LoadScene("ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTestScene"); | ||
} | ||
|
||
/// <summary> | ||
/// Verify in each update, the Academy is only stepped once. | ||
/// </summary> | ||
[UnityTest] | ||
public IEnumerator AcademyStepperCleanupPasses() | ||
{ | ||
var academy = Academy.Instance; | ||
int initStepCount = academy.TotalStepCount; | ||
for (var i = 0; i < 5; i++) | ||
{ | ||
yield return new WaitForFixedUpdate(); | ||
Assert.True(academy.TotalStepCount - initStepCount == i + 1); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
DevProject/Assets/ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTest.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.