浏览代码

Fix errors when creating new RayCast sensor (#5261)

* check if tag and angle is null

* add test

* changelog
/check-for-ModelOverriders
GitHub 4 年前
当前提交
1b93ba03
共有 3 个文件被更改,包括 15 次插入1 次删除
  1. 1
      com.unity.ml-agents/CHANGELOG.md
  2. 2
      com.unity.ml-agents/Runtime/Sensors/RayPerceptionSensor.cs
  3. 13
      com.unity.ml-agents/Tests/Runtime/Sensor/RayPerceptionSensorTests.cs

1
com.unity.ml-agents/CHANGELOG.md


settings. Unfortunately, this may require retraining models if it changes the resulting order of the sensors
or actuators on your system. (#5194)
- Removed additional memory allocations that were occurring due to assert messages and iterating of DemonstrationRecorders. (#5246)
- Fixed a bug where agent trying to access unintialized fields when creating a new RayPerceptionSensorComponent on an agent. (#5261)
## [1.9.1-preview] - 2021-04-13
### Major Changes

2
com.unity.ml-agents/Runtime/Sensors/RayPerceptionSensor.cs


/// <returns></returns>
public int OutputSize()
{
return (DetectableTags.Count + 2) * Angles.Count;
return ((DetectableTags?.Count ?? 0) + 2) * (Angles?.Count ?? 0);
}
/// <summary>

13
com.unity.ml-agents/Tests/Runtime/Sensor/RayPerceptionSensorTests.cs


Assert.AreEqual(-1, castOutput.RayOutputs[0].HitTagIndex);
}
}
[Test]
public void TestCreateDefault()
{
SetupScene();
var obj = new GameObject("agent");
var perception = obj.AddComponent<RayPerceptionSensorComponent3D>();
Assert.DoesNotThrow(() =>
{
perception.CreateSensors();
});
}
#endif
}
}
正在加载...
取消
保存