Skip to content
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
1 change: 1 addition & 0 deletions com.unity.ml-agents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ This results in much less memory being allocated during inference with `CameraSe
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
Expand Down
2 changes: 1 addition & 1 deletion com.unity.ml-agents/Runtime/Sensors/RayPerceptionSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public struct RayPerceptionInput
/// <returns></returns>
public int OutputSize()
{
return (DetectableTags.Count + 2) * Angles.Count;
return ((DetectableTags?.Count ?? 0) + 2) * (Angles?.Count ?? 0);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,19 @@ public void TestStaticPerceiveNoTags()
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
}
}