diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md
index 7f7eff3a95..db3b194051 100755
--- a/com.unity.ml-agents/CHANGELOG.md
+++ b/com.unity.ml-agents/CHANGELOG.md
@@ -14,6 +14,8 @@ and this project adheres to
### Minor Changes
#### com.unity.ml-agents / com.unity.ml-agents.extensions (C#)
+- Added DecisionStep parameter to DecisionRequester (#)
+ - This will allow the staggering of execution timing when using multi-agents, leading to more stable performance.
#### ml-agents / ml-agents-envs
- Added training config feature to evenly distribute checkpoints throughout training. (#5842)
diff --git a/com.unity.ml-agents/Runtime/DecisionRequester.cs b/com.unity.ml-agents/Runtime/DecisionRequester.cs
index 49590c7be4..bee232f574 100644
--- a/com.unity.ml-agents/Runtime/DecisionRequester.cs
+++ b/com.unity.ml-agents/Runtime/DecisionRequester.cs
@@ -30,6 +30,17 @@ public class DecisionRequester : MonoBehaviour
"of 5 means that the Agent will request a decision every 5 Academy steps.")]
public int DecisionPeriod = 5;
+ ///
+ /// Indicates when to requests a decision. By changing this value, the timing of decision
+ /// can be shifted even among agents with the same decision period. The value can be
+ /// from 0 to DecisionPeriod - 1.
+ ///
+ [Range(0, 19)]
+ [Tooltip("Indicates when to requests a decision. By changing this value, the timing " +
+ "of decision can be shifted even among agents with the same decision period. " +
+ "The value can be from 0 to DecisionPeriod - 1.")]
+ public int DecisionStep = 0;
+
///
/// Indicates whether or not the agent will take an action during the Academy steps where
/// it does not request a decision. Has no effect when DecisionPeriod is set to 1.
@@ -53,6 +64,7 @@ public Agent Agent
internal void Awake()
{
+ Debug.Assert(DecisionStep < DecisionPeriod, "DecisionStep must be between 0 than DecisionPeriod - 1.");
m_Agent = gameObject.GetComponent();
Debug.Assert(m_Agent != null, "Agent component was not found on this gameObject and is required.");
Academy.Instance.AgentPreStep += MakeRequests;
@@ -107,7 +119,7 @@ void MakeRequests(int academyStepCount)
///
protected virtual bool ShouldRequestDecision(DecisionRequestContext context)
{
- return context.AcademyStepCount % DecisionPeriod == 0;
+ return context.AcademyStepCount % DecisionPeriod == DecisionStep;
}
///