-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Make a serialization upgrade path for maxStep and add tests. #3424
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b26aeb2
Make a serialization upgrade path for maxStep and add tests.
surfnerd 7f39cfb
Move runtime tests to the package.
surfnerd 2af660e
Wait for scene to be loaded.
surfnerd 9ab1f59
Remove log and dirty markers.
surfnerd 76d9da3
Check if maxstep was 0 before upgrading.
surfnerd 0643f1a
Always set the upgrade flag in serialization callbacks.
surfnerd dff2526
add a cube for good measure.
surfnerd b8f967b
Use virtualized package path for scene.
surfnerd ce8c8a5
Comment out test since the framework we need to modify the build sett…
surfnerd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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.
This file contains hidden or 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,51 @@ | ||
| // using System.Collections; | ||
| // using NUnit.Framework; | ||
| // #if UNITY_EDITOR | ||
| // using UnityEditor.SceneManagement; | ||
| // using UnityEngine.TestTools; | ||
| // #endif | ||
| // using UnityEngine; | ||
| // using UnityEngine.SceneManagement; | ||
| // | ||
| // namespace Tests | ||
| // { | ||
| // [TestFixture] | ||
| // public class SerializationTest | ||
| // { | ||
| // | ||
| // [SetUp] | ||
| // public void Setup() | ||
| // { | ||
| // SceneManager.LoadScene("Packages/com.unity.ml-agents/Tests/Runtime/SerializeTestScene"); | ||
| // } | ||
| // | ||
| // /// <summary> | ||
| // /// Test that the serialized agent in the scene, which has its agent parameter value serialized, | ||
| // /// properly deserializes it to Agent.maxStep. | ||
| // /// </summary> | ||
| // [UnityTest] | ||
| // public IEnumerator SerializationTestSimplePasses() | ||
| // { | ||
| // // Use the Assert class to test conditions | ||
| // var gameObjects = SceneManager.GetActiveScene().GetRootGameObjects(); | ||
| // if (SceneManager.GetActiveScene().name != "SerializeTestScene") | ||
| // { | ||
| // yield return null; | ||
| // } | ||
| // | ||
| // GameObject agent = null; | ||
| // foreach (var go in gameObjects) | ||
| // { | ||
| // if (go.name == "Agent") | ||
| // { | ||
| // agent = go; | ||
| // break; | ||
| // } | ||
| // } | ||
| // Assert.NotNull(agent); | ||
| // var agentComponent = agent.GetComponent<SerializeAgent>(); | ||
| // Assert.True(agentComponent.maxStep == 5000); | ||
| // | ||
| // } | ||
| // } | ||
| // } |
11 changes: 11 additions & 0 deletions
11
com.unity.ml-agents/Tests/Runtime/SerializationTest.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,12 @@ | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
| using MLAgents; | ||
|
|
||
| public class SerializeAgent : Agent | ||
| { | ||
| public override float[] Heuristic() | ||
| { | ||
| return new[] {0f}; | ||
| } | ||
| } |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.