Skip to content

Commit

Permalink
use Debug.AssertFormat to avoid string formatting in DEBUG (#4879)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Elion authored Jan 22, 2021
1 parent 66c2931 commit 78c3f31
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion com.unity.ml-agents/Runtime/Sensors/SensorShapeValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ public void ValidateSensors(List<ISensor> sensors)
{
// Check for compatibility with the other Agents' Sensors
// TODO make sure this only checks once per agent
Debug.Assert(m_SensorShapes.Count == sensors.Count, $"Number of Sensors must match. {m_SensorShapes.Count} != {sensors.Count}");
Debug.AssertFormat(
m_SensorShapes.Count == sensors.Count,
"Number of Sensors must match. {0} != {1}",
m_SensorShapes.Count,
sensors.Count
);
for (var i = 0; i < Mathf.Min(m_SensorShapes.Count, sensors.Count); i++)
{
var cachedShape = m_SensorShapes[i];
Expand Down

0 comments on commit 78c3f31

Please sign in to comment.