From 27cbc396cd770ff9efc8b2b33255d5f988c66376 Mon Sep 17 00:00:00 2001 From: Vincent-Pierre BERGES Date: Mon, 8 Mar 2021 13:22:47 -0800 Subject: [PATCH] Removing Obsolete methods from the package (#5024) * Removing Obsolete methods from the package * Missing depecration and modified changelog * Readding the obsolete BrainParameter methods, will need a larger discussion on these * Removing Action Masker, readding the warining when using a non-implemented Heuristic, Removing NumAction from Brain Parameters * removing documentation and some calls to deprecated methods in the extensions package * Editing the Changelog to put the unreleased on top --- .../Basic/Scripts/BasicActuatorComponent.cs | 6 +- .../Scripts/Match3ExampleActuatorComponent.cs | 6 +- .../Runtime/Input/InputActuatorComponent.cs | 5 -- .../Runtime/Match3/Match3ActuatorComponent.cs | 6 +- com.unity.ml-agents/CHANGELOG.md | 17 ++++ .../Runtime/Actuators/ActuatorComponent.cs | 14 +--- .../Runtime/Actuators/IActionReceiver.cs | 41 ---------- com.unity.ml-agents/Runtime/Agent.cs | 81 +------------------ .../Runtime/Agent.deprecated.cs | 63 --------------- .../Runtime/Agent.deprecated.cs.meta | 3 - .../Runtime/DiscreteActionMasker.cs | 62 -------------- .../Runtime/DiscreteActionMasker.cs.meta | 3 - .../Runtime/Policies/BrainParameters.cs | 12 --- .../Runtime/Sensors/ObservationWriter.cs | 28 ------- .../Runtime/Sensors/SensorComponent.cs | 21 ----- .../Runtime/Sensors/VectorSensor.cs | 13 --- .../SideChannels/SideChannelManager.cs | 25 ------ .../Tests/Editor/MLAgentsEditModeTest.cs | 6 -- docs/Learning-Environment-Design-Agents.md | 2 +- docs/Migrating.md | 3 + 20 files changed, 31 insertions(+), 386 deletions(-) delete mode 100644 com.unity.ml-agents/Runtime/Agent.deprecated.cs delete mode 100644 com.unity.ml-agents/Runtime/Agent.deprecated.cs.meta delete mode 100644 com.unity.ml-agents/Runtime/DiscreteActionMasker.cs delete mode 100644 com.unity.ml-agents/Runtime/DiscreteActionMasker.cs.meta diff --git a/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicActuatorComponent.cs b/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicActuatorComponent.cs index afde4117d8..cd019a1424 100644 --- a/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicActuatorComponent.cs +++ b/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicActuatorComponent.cs @@ -17,11 +17,9 @@ public class BasicActuatorComponent : ActuatorComponent /// Creates a BasicActuator. /// /// -#pragma warning disable 672 - public override IActuator CreateActuator() -#pragma warning restore 672 + public override IActuator[] CreateActuators() { - return new BasicActuator(basicController); + return new IActuator[] { new BasicActuator(basicController) }; } public override ActionSpec ActionSpec diff --git a/Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3ExampleActuatorComponent.cs b/Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3ExampleActuatorComponent.cs index 7033b35ff3..6e9a2c5e69 100644 --- a/Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3ExampleActuatorComponent.cs +++ b/Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3ExampleActuatorComponent.cs @@ -7,14 +7,12 @@ namespace Unity.MLAgentsExamples public class Match3ExampleActuatorComponent : Match3ActuatorComponent { /// -#pragma warning disable 672 - public override IActuator CreateActuator() -#pragma warning restore 672 + public override IActuator[] CreateActuators() { var board = GetComponent(); var agent = GetComponentInParent(); var seed = RandomSeed == -1 ? gameObject.GetInstanceID() : RandomSeed + 1; - return new Match3ExampleActuator(board, ForceHeuristic, agent, ActuatorName, seed); + return new IActuator[] { new Match3ExampleActuator(board, ForceHeuristic, agent, ActuatorName, seed) }; } } } diff --git a/com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs b/com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs index 665d6844f9..71c5b1a6ad 100644 --- a/com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs +++ b/com.unity.ml-agents.extensions/Runtime/Input/InputActuatorComponent.cs @@ -255,11 +255,6 @@ internal static InputControlScheme CreateControlScheme(InputControl device, return inputControlScheme; } -#pragma warning disable 672 - /// - public override IActuator CreateActuator() { return null; } -#pragma warning restore 672 - /// /// /// diff --git a/com.unity.ml-agents.extensions/Runtime/Match3/Match3ActuatorComponent.cs b/com.unity.ml-agents.extensions/Runtime/Match3/Match3ActuatorComponent.cs index 4f17e2964f..bca7b8f163 100644 --- a/com.unity.ml-agents.extensions/Runtime/Match3/Match3ActuatorComponent.cs +++ b/com.unity.ml-agents.extensions/Runtime/Match3/Match3ActuatorComponent.cs @@ -29,14 +29,12 @@ public class Match3ActuatorComponent : ActuatorComponent public bool ForceHeuristic; /// -#pragma warning disable 672 - public override IActuator CreateActuator() -#pragma warning restore 672 + public override IActuator[] CreateActuators() { var board = GetComponent(); var agent = GetComponentInParent(); var seed = RandomSeed == -1 ? gameObject.GetInstanceID() : RandomSeed + 1; - return new Match3Actuator(board, ForceHeuristic, seed, agent, ActuatorName); + return new IActuator[] { new Match3Actuator(board, ForceHeuristic, seed, agent, ActuatorName) }; } /// diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index 27e5b02f8f..4dccc17be1 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -9,6 +9,23 @@ and this project adheres to ## [Unreleased] ### Major Changes #### com.unity.ml-agents (C#) +====== +- Some methods previously marked as `Obsolete` have been removed. If you were using these methods, you need to replace them with their supported counterpart. +#### ml-agents / ml-agents-envs / gym-unity (Python) + +### Minor Changes +#### com.unity.ml-agents / com.unity.ml-agents.extensions (C#) +#### ml-agents / ml-agents-envs / gym-unity (Python) + +### Bug Fixes +#### com.unity.ml-agents (C#) +#### ml-agents / ml-agents-envs / gym-unity (Python) + + +## [1.9.0-preview] - 2021-03-17 +### Major Changes +#### com.unity.ml-agents (C#) +- The `BufferSensor` and `BufferSensorComponent` have been added. They allow the Agent to observe variable number of entities. (#4909) #### ml-agents / ml-agents-envs / gym-unity (Python) ### Minor Changes diff --git a/com.unity.ml-agents/Runtime/Actuators/ActuatorComponent.cs b/com.unity.ml-agents/Runtime/Actuators/ActuatorComponent.cs index 8e0b1814a3..215267992c 100644 --- a/com.unity.ml-agents/Runtime/Actuators/ActuatorComponent.cs +++ b/com.unity.ml-agents/Runtime/Actuators/ActuatorComponent.cs @@ -9,24 +9,12 @@ namespace Unity.MLAgents.Actuators /// public abstract class ActuatorComponent : MonoBehaviour { - /// - /// Create the IActuator. This is called by the Agent when it is initialized. - /// - /// Created IActuator object. - [Obsolete("Use CreateActuators instead.")] - public abstract IActuator CreateActuator(); - /// /// Create a collection of s. This is called by the during /// initialization. /// /// A collection of s - public virtual IActuator[] CreateActuators() - { -#pragma warning disable 618 - return new[] { CreateActuator() }; -#pragma warning restore 618 - } + public abstract IActuator[] CreateActuators(); /// /// The specification of the possible actions for this ActuatorComponent. diff --git a/com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs b/com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs index 79dad3e0aa..f56fe7f776 100644 --- a/com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs +++ b/com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs @@ -148,47 +148,6 @@ public override int GetHashCode() return (ContinuousActions.GetHashCode() * 397) ^ DiscreteActions.GetHashCode(); } } - - /// - /// Packs the continuous and discrete actions into one float array. The array passed into this method - /// must have a Length that is greater than or equal to the sum of the Lengths of - /// and . - /// - /// A float array to pack actions into whose length is greater than or - /// equal to the addition of the Lengths of this objects and - /// segments. - [Obsolete("PackActions has been deprecated.")] - public void PackActions(in float[] destination) - { - Debug.Assert(destination.Length >= ContinuousActions.Length + DiscreteActions.Length, - $"argument '{nameof(destination)}' is not large enough to pack the actions into.\n" + - $"{nameof(destination)}.Length: {destination.Length}\n" + - $"{nameof(ContinuousActions)}.Length + {nameof(DiscreteActions)}.Length: {ContinuousActions.Length + DiscreteActions.Length}"); - - var start = 0; - if (ContinuousActions.Length > 0) - { - Array.Copy(ContinuousActions.Array, - ContinuousActions.Offset, - destination, - start, - ContinuousActions.Length); - start = ContinuousActions.Length; - } - if (start >= destination.Length) - { - return; - } - - if (DiscreteActions.Length > 0) - { - Array.Copy(DiscreteActions.Array, - DiscreteActions.Offset, - destination, - start, - DiscreteActions.Length); - } - } } /// diff --git a/com.unity.ml-agents/Runtime/Agent.cs b/com.unity.ml-agents/Runtime/Agent.cs index 5a37347b31..65e564a10a 100644 --- a/com.unity.ml-agents/Runtime/Agent.cs +++ b/com.unity.ml-agents/Runtime/Agent.cs @@ -301,9 +301,6 @@ internal struct AgentParameters /// Whether or not the Agent has been initialized already bool m_Initialized; - /// Keeps track of the actions that are masked at each step. - DiscreteActionMasker m_ActionMasker; - /// /// Set of DemonstrationWriters that the Agent will write its step information to. /// If you use a DemonstrationRecorder component, this will automatically register its DemonstrationWriter. @@ -338,17 +335,6 @@ internal struct AgentParameters /// IActuator m_VectorActuator; - /// - /// This is used to avoid allocation of a float array every frame if users are still using the old - /// OnActionReceived method. - /// - float[] m_LegacyActionCache; - - /// - /// This is used to avoid allocation of a float array during legacy calls to Heuristic. - /// - float[] m_LegacyHeuristicCache; - /// Currect MultiAgentGroup ID. Default to 0 (meaning no group) int m_GroupId; @@ -952,29 +938,7 @@ public virtual void Initialize() { } /// public virtual void Heuristic(in ActionBuffers actionsOut) { - // Disable deprecation warnings so we can call the legacy overload. -#pragma warning disable CS0618 - - // The default implementation of Heuristic calls the - // obsolete version for backward compatibility - switch (m_PolicyFactory.BrainParameters.VectorActionSpaceType) - { - case SpaceType.Continuous: - Heuristic(m_LegacyHeuristicCache); - Array.Copy(m_LegacyHeuristicCache, actionsOut.ContinuousActions.Array, m_LegacyActionCache.Length); - actionsOut.DiscreteActions.Clear(); - break; - case SpaceType.Discrete: - Heuristic(m_LegacyHeuristicCache); - var discreteActionSegment = actionsOut.DiscreteActions; - for (var i = 0; i < actionsOut.DiscreteActions.Length; i++) - { - discreteActionSegment[i] = (int)m_LegacyHeuristicCache[i]; - } - actionsOut.ContinuousActions.Clear(); - break; - } -#pragma warning restore CS0618 + Debug.LogWarning("Heuristic method called but not implemented. Returning placeholder actions."); } /// @@ -1064,8 +1028,6 @@ void InitializeActuators() var param = m_PolicyFactory.BrainParameters; m_VectorActuator = new AgentVectorActuator(this, this, param.ActionSpec); m_ActuatorManager = new ActuatorManager(attachedActuators.Length + 1); - m_LegacyActionCache = new float[m_VectorActuator.TotalNumberOfActions()]; - m_LegacyHeuristicCache = new float[m_VectorActuator.TotalNumberOfActions()]; m_ActuatorManager.Add(m_VectorActuator); @@ -1223,17 +1185,7 @@ public ReadOnlyCollection GetObservations() /// [Agents - Actions]: https://github.com/Unity-Technologies/ml-agents/blob/release_15_docs/docs/Learning-Environment-Design-Agents.md#actions /// /// - public virtual void WriteDiscreteActionMask(IDiscreteActionMask actionMask) - { - if (m_ActionMasker == null) - { - m_ActionMasker = new DiscreteActionMasker(actionMask); - } - // Disable deprecation warnings so we can call the legacy overload. -#pragma warning disable CS0618 - CollectDiscreteActionMasks(m_ActionMasker); -#pragma warning restore CS0618 - } + public virtual void WriteDiscreteActionMask(IDiscreteActionMask actionMask) { } /// /// Implement `OnActionReceived()` to specify agent behavior at every step, based @@ -1301,34 +1253,7 @@ public virtual void WriteDiscreteActionMask(IDiscreteActionMask actionMask) /// /// Struct containing the buffers of actions to be executed at this step. /// - public virtual void OnActionReceived(ActionBuffers actions) - { - var actionSpec = m_PolicyFactory.BrainParameters.ActionSpec; - // For continuous and discrete actions together, we don't need to fall back to the legacy method - if (actionSpec.NumContinuousActions > 0 && actionSpec.NumDiscreteActions > 0) - { - // Nothing implemented. - return; - } - - if (!actions.ContinuousActions.IsEmpty()) - { - Array.Copy(actions.ContinuousActions.Array, - m_LegacyActionCache, - actionSpec.NumContinuousActions); - } - else - { - for (var i = 0; i < m_LegacyActionCache.Length; i++) - { - m_LegacyActionCache[i] = (float)actions.DiscreteActions[i]; - } - } - // Disable deprecation warnings so we can call the legacy overload. -#pragma warning disable CS0618 - OnActionReceived(m_LegacyActionCache); -#pragma warning restore CS0618 - } + public virtual void OnActionReceived(ActionBuffers actions) { } /// /// Implement `OnEpisodeBegin()` to set up an Agent instance at the beginning diff --git a/com.unity.ml-agents/Runtime/Agent.deprecated.cs b/com.unity.ml-agents/Runtime/Agent.deprecated.cs deleted file mode 100644 index fd9d6a1a88..0000000000 --- a/com.unity.ml-agents/Runtime/Agent.deprecated.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.Profiling; - -namespace Unity.MLAgents -{ - public partial class Agent - { - /// - /// Deprecated, use instead. - /// - /// - [Obsolete("CollectDiscreteActionMasks has been deprecated, please use WriteDiscreteActionMask.")] - public virtual void CollectDiscreteActionMasks(DiscreteActionMasker actionMasker) - { - } - - /// - /// Deprecated, use instead. - /// - /// - [Obsolete("The float[] version of Heuristic has been deprecated, please use the ActionBuffers version instead.")] - public virtual void Heuristic(float[] actionsOut) - { - Debug.LogWarning("Heuristic method called but not implemented. Returning placeholder actions."); - Array.Clear(actionsOut, 0, actionsOut.Length); - } - - /// - /// Deprecated, use instead. - /// - /// - [Obsolete("The float[] version of OnActionReceived has been deprecated, please use the ActionBuffers version instead.")] - public virtual void OnActionReceived(float[] vectorAction) { } - - /// - /// Returns the last action that was decided on by the Agent. - /// - /// - /// The last action that was decided by the Agent (or null if no decision has been made). - /// - /// - [Obsolete("GetAction has been deprecated, please use GetStoredActionBuffers instead.")] - public float[] GetAction() - { - Profiler.BeginSample("Agent.GetAction.Deprecated"); - var actionSpec = m_PolicyFactory.BrainParameters.ActionSpec; - // For continuous and discrete actions together, this shouldn't be called because we can only return one. - if (actionSpec.NumContinuousActions > 0 && actionSpec.NumDiscreteActions > 0) - { - Debug.LogWarning("Agent.GetAction() when both continuous and discrete actions are in use. Use Agent.GetStoredActionBuffers() instead."); - } - - var storedAction = m_Info.storedActions; - if (!storedAction.ContinuousActions.IsEmpty()) - { - return storedAction.ContinuousActions.Array; - } - Profiler.EndSample(); - return Array.ConvertAll(storedAction.DiscreteActions.Array, x => (float)x); - } - } -} diff --git a/com.unity.ml-agents/Runtime/Agent.deprecated.cs.meta b/com.unity.ml-agents/Runtime/Agent.deprecated.cs.meta deleted file mode 100644 index 767483f7f7..0000000000 --- a/com.unity.ml-agents/Runtime/Agent.deprecated.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9650a482703b47db8cd7fb2df8caa1bf -timeCreated: 1595613441 \ No newline at end of file diff --git a/com.unity.ml-agents/Runtime/DiscreteActionMasker.cs b/com.unity.ml-agents/Runtime/DiscreteActionMasker.cs deleted file mode 100644 index 48232f08da..0000000000 --- a/com.unity.ml-agents/Runtime/DiscreteActionMasker.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Collections.Generic; -using Unity.MLAgents.Actuators; - -namespace Unity.MLAgents -{ - /// - /// The DiscreteActionMasker class represents a set of masked (disallowed) actions and - /// provides utilities for setting and retrieving them. - /// - /// - /// Agents that take discrete actions can explicitly indicate that specific actions - /// are not allowed at a point in time. This enables the agent to indicate that some actions - /// may be illegal. For example, if an agent is adjacent to a wall or other obstacle - /// you could mask any actions that direct the agent to move into the blocked space. - /// - public class DiscreteActionMasker : IDiscreteActionMask - { - IDiscreteActionMask m_Delegate; - - internal DiscreteActionMasker(IDiscreteActionMask actionMask) - { - m_Delegate = actionMask; - } - - /// - /// Modifies an action mask for discrete control agents. - /// - /// - /// When used, the agent will not be able to perform the actions passed as argument - /// at the next decision for the specified action branch. The actionIndices correspond - /// to the action options the agent will be unable to perform. - /// - /// See [Agents - Actions] for more information on masking actions. - /// - /// [Agents - Actions]: https://github.com/Unity-Technologies/ml-agents/blob/release_15_docs/docs/Learning-Environment-Design-Agents.md#actions - /// - /// The branch for which the actions will be masked. - /// The indices of the masked actions. - public void SetMask(int branch, IEnumerable actionIndices) - { - m_Delegate.WriteMask(branch, actionIndices); - } - - /// - public void WriteMask(int branch, IEnumerable actionIndices) - { - m_Delegate.WriteMask(branch, actionIndices); - } - - /// - public bool[] GetMask() - { - return m_Delegate.GetMask(); - } - - /// - public void ResetMask() - { - m_Delegate.ResetMask(); - } - } -} diff --git a/com.unity.ml-agents/Runtime/DiscreteActionMasker.cs.meta b/com.unity.ml-agents/Runtime/DiscreteActionMasker.cs.meta deleted file mode 100644 index a7ab396c89..0000000000 --- a/com.unity.ml-agents/Runtime/DiscreteActionMasker.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8a0ec4ccf4ee450da7766f65228d5460 -timeCreated: 1534530911 \ No newline at end of file diff --git a/com.unity.ml-agents/Runtime/Policies/BrainParameters.cs b/com.unity.ml-agents/Runtime/Policies/BrainParameters.cs index fde0d04a12..0b7c83fa34 100644 --- a/com.unity.ml-agents/Runtime/Policies/BrainParameters.cs +++ b/com.unity.ml-agents/Runtime/Policies/BrainParameters.cs @@ -100,18 +100,6 @@ public ActionSpec ActionSpec [HideInInspector] internal bool hasUpgradedBrainParametersWithActionSpec; - /// - /// (Deprecated) The number of actions specified by this Brain. - /// - [Obsolete("NumActions has been deprecated, please use ActionSpec instead.")] - public int NumActions - { - get - { - return ActionSpec.NumContinuousActions > 0 ? ActionSpec.NumContinuousActions : ActionSpec.NumDiscreteActions; - } - } - /// /// Deep clones the BrainParameter object. /// diff --git a/com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs b/com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs index 67832c4a1a..e3e958011e 100644 --- a/com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs +++ b/com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs @@ -117,34 +117,6 @@ public float this[int index] } } - /// - /// Write the range of floats - /// - /// - /// Optional write offset. - [Obsolete("Use AddList() for better performance")] - public void AddRange(IEnumerable data, int writeOffset = 0) - { - if (m_Data != null) - { - int index = 0; - foreach (var val in data) - { - m_Data[index + m_Offset + writeOffset] = val; - index++; - } - } - else - { - int index = 0; - foreach (var val in data) - { - m_Proxy.data[m_Batch, index + m_Offset + writeOffset] = val; - index++; - } - } - } - /// /// Write the list of floats. /// diff --git a/com.unity.ml-agents/Runtime/Sensors/SensorComponent.cs b/com.unity.ml-agents/Runtime/Sensors/SensorComponent.cs index bd139312e7..a217e5d159 100644 --- a/com.unity.ml-agents/Runtime/Sensors/SensorComponent.cs +++ b/com.unity.ml-agents/Runtime/Sensors/SensorComponent.cs @@ -21,26 +21,5 @@ public abstract class SensorComponent : MonoBehaviour /// Shape of the sensor observation. public abstract int[] GetObservationShape(); - /// - /// Whether the observation is visual or not. - /// - /// True if the observation is visual, false otherwise. - [Obsolete("IsVisual is deprecated, please use GetObservationShape() instead.")] - public virtual bool IsVisual() - { - var shape = GetObservationShape(); - return shape.Length == 3; - } - - /// - /// Whether the observation is vector or not. - /// - /// True if the observation is vector, false otherwise. - [Obsolete("IsVisual is deprecated, please use GetObservationShape() instead.")] - public virtual bool IsVector() - { - var shape = GetObservationShape(); - return shape.Length == 1; - } } } diff --git a/com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs b/com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs index 62276b110a..c1017a0b77 100644 --- a/com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs @@ -167,19 +167,6 @@ public void AddObservation(Vector2 observation) AddFloatObs(observation.y); } - /// - /// Adds a collection of float observations to the vector observations of the agent. - /// - /// Observation. - [Obsolete("Use AddObservation(IList) for better performance.")] - public void AddObservation(IEnumerable observation) - { - foreach (var f in observation) - { - AddFloatObs(f); - } - } - /// /// Adds a list or array of float observations to the vector observations of the agent. /// diff --git a/com.unity.ml-agents/Runtime/SideChannels/SideChannelManager.cs b/com.unity.ml-agents/Runtime/SideChannels/SideChannelManager.cs index 93931a170d..bdcc596b85 100644 --- a/com.unity.ml-agents/Runtime/SideChannels/SideChannelManager.cs +++ b/com.unity.ml-agents/Runtime/SideChannels/SideChannelManager.cs @@ -241,29 +241,4 @@ internal static void ProcessSideChannelData(Dictionary sideCh } } } - - /// - /// Deprecated, use instead. - /// - [Obsolete("Use SideChannelManager instead.")] - public static class SideChannelsManager - { - /// - /// Deprecated, use instead. - /// - /// - public static void RegisterSideChannel(SideChannel sideChannel) - { - SideChannelManager.RegisterSideChannel(sideChannel); - } - - /// - /// Deprecated, use instead. - /// - /// - public static void UnregisterSideChannel(SideChannel sideChannel) - { - SideChannelManager.UnregisterSideChannel(sideChannel); - } - } } diff --git a/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs b/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs index e8be0c36bb..07dd089ceb 100644 --- a/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs +++ b/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs @@ -711,16 +711,10 @@ public void TestHeuristicPolicyStepsSensors() Assert.AreEqual(numSteps, agent1.sensor1.numWriteCalls); Assert.AreEqual(numSteps, agent1.sensor2.numCompressedCalls); - // Disable deprecation warnings so we can read/write the old fields. -#pragma warning disable CS0618 - - // Make sure the Heuristic method read the observation and set the action - Assert.AreEqual(agent1.collectObservationsCallsForEpisode, agent1.GetAction()[0]); Assert.AreEqual( agent1.collectObservationsCallsForEpisode, agent1.GetStoredActionBuffers().ContinuousActions[0] ); -#pragma warning restore CS0618 } } diff --git a/docs/Learning-Environment-Design-Agents.md b/docs/Learning-Environment-Design-Agents.md index 8c980f886d..d0eab75405 100644 --- a/docs/Learning-Environment-Design-Agents.md +++ b/docs/Learning-Environment-Design-Agents.md @@ -707,7 +707,7 @@ Notes: The Actuator API allows users to abstract behavior out of Agents and in to components (similar to the ISensor API). The `IActuator` interface and `Agent` class both implement the `IActionReceiver` interface to allow for backward compatibility -with the current `Agent.OnActionReceived` and `Agent.CollectDiscreteActionMasks` APIs. +with the current `Agent.OnActionReceived`. This means you will not have to change your code until you decide to use the `IActuator` API. Like the `ISensor` interface, the `IActuator` interface is intended for advanced users. diff --git a/docs/Migrating.md b/docs/Migrating.md index 0a943a53e0..dd367621e5 100644 --- a/docs/Migrating.md +++ b/docs/Migrating.md @@ -14,6 +14,9 @@ double-check that the versions are in the same. The versions can be found in # Migrating +## Migrating the package to version 2.0 +- 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. + ## Migrating to Release 13 ### Implementing IHeuristic in your IActuator implementations - If you have any custom actuators, you can now implement the `IHeuristicProvider` interface to have your actuator