Skip to content

Move Monitor to Examples #3372

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 5 commits into from
Feb 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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public override void InitializeAgent()
{
base.InitializeAgent();
m_AgentRb = GetComponent<Rigidbody>();
Monitor.verticalOffset = 1f;
m_MyArea = area.GetComponent<FoodCollectorArea>();
m_FoodCollecterSettings = FindObjectOfType<FoodCollectorSettings>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

Expand Down Expand Up @@ -561,4 +561,4 @@ void Initialize()
s_RedStyle = s_ColorStyle[5];
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace MLAgentsExamples
public class ProjectSettingsOverrides : MonoBehaviour
{
// Original values
float m_OriginalMonitorVerticalOffset;

Vector3 m_OriginalGravity;
float m_OriginalFixedDeltaTime;
float m_OriginalMaximumDeltaTime;
Expand All @@ -16,9 +16,6 @@ public class ProjectSettingsOverrides : MonoBehaviour
[Tooltip("Increase or decrease the scene gravity. Use ~3x to make things less floaty")]
public float gravityMultiplier = 1.0f;

[Header("Display Settings")]
public float monitorVerticalOffset;

[Header("Advanced physics settings")]
[Tooltip("The interval in seconds at which physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate) are performed.")]
public float fixedDeltaTime = .02f;
Expand All @@ -32,15 +29,13 @@ public class ProjectSettingsOverrides : MonoBehaviour
public void Awake()
{
// Save the original values
m_OriginalMonitorVerticalOffset = Monitor.verticalOffset;
m_OriginalGravity = Physics.gravity;
m_OriginalFixedDeltaTime = Time.fixedDeltaTime;
m_OriginalMaximumDeltaTime = Time.maximumDeltaTime;
m_OriginalSolverIterations = Physics.defaultSolverIterations;
m_OriginalSolverVelocityIterations = Physics.defaultSolverVelocityIterations;

// Override
Monitor.verticalOffset = monitorVerticalOffset;
Physics.gravity *= gravityMultiplier;
Time.fixedDeltaTime = fixedDeltaTime;
Time.maximumDeltaTime = maximumDeltaTime;
Expand All @@ -52,7 +47,6 @@ public void Awake()

public void OnDestroy()
{
Monitor.verticalOffset = m_OriginalMonitorVerticalOffset;
Physics.gravity = m_OriginalGravity;
Time.fixedDeltaTime = m_OriginalFixedDeltaTime;
Time.maximumDeltaTime = m_OriginalMaximumDeltaTime;
Expand Down
3 changes: 0 additions & 3 deletions com.unity.ml-agents/Runtime/DemonstrationRecorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class DemonstrationRecorder : MonoBehaviour
{
public bool record;
public string demonstrationName;
Agent m_RecordingAgent;
string m_FilePath;
DemonstrationStore m_DemoStore;
public const int MaxNameLength = 16;
Expand All @@ -41,15 +40,13 @@ void Update()
/// </summary>
public void InitializeDemoStore(IFileSystem fileSystem = null)
{
m_RecordingAgent = GetComponent<Agent>();
m_DemoStore = new DemonstrationStore(fileSystem);
var behaviorParams = GetComponent<BehaviorParameters>();
demonstrationName = SanitizeName(demonstrationName, MaxNameLength);
m_DemoStore.Initialize(
demonstrationName,
behaviorParams.brainParameters,
behaviorParams.fullyQualifiedBehaviorName);
Monitor.Log("Recording Demonstration of Agent: ", m_RecordingAgent.name);
}

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions docs/Migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ The versions can be found in
# Migrating

## Migrating from 0.14 to latest

### Important changes
* The `Monitor` class has been moved to the Examples Project. (It was prone to errors during testing)

### Steps to Migrate


## Migrating from 0.13 to 0.14

### Important changes
Expand Down