Hi,
After upgrading to 5.5, we’ve noticed some checks firing on null optional observations. The checks appear to be attempting to enforce the RESTRICT qualifier on array inputs, but if the arrays are null, the check still gets tripped anyway, even though the loop gets skipped due to input/output sizes of 0. I’ve attached a sample repro based on the “Learn to Drive” sample that has a “UCrashyInteractor” that provides a minimal repro.
This is the interactor code that triggers the crash:
`// CrashyInteractor.cpp
#define OBSERVATION_1 FName(TEXT(“Observation_1”))
#define OBSERVATION_2 FName(TEXT(“Observation_2”))
#define OBSERVATION_3 FName(TEXT(“Observation_3”))
#define ACTION_1 FName(TEXT(“Action_1”))
#define ACTION_2 FName(TEXT(“Action_2”))
void UCrashyInteractor::SpecifyAgentObservation_Implementation(FLearningAgentsObservationSchemaElement& OutObservationSchemaElement, ULearningAgentsObservationSchema* InObservationSchema)
{
FLearningAgentsObservationSchemaElement Observation_1 = ULearningAgentsObservations::SpecifyStructObservationFromArrayViews(InObservationSchema,
{
OBSERVATION_1,
},
{
ULearningAgentsObservations::SpecifyBoolObservation(InObservationSchema, OBSERVATION_1),
});
OutObservationSchemaElement = ULearningAgentsObservations::SpecifyStructObservationFromArrayViews(InObservationSchema,
{
OBSERVATION_2,
OBSERVATION_3,
},
{
ULearningAgentsObservations::SpecifyOptionalObservation(InObservationSchema, Observation_1, 128, OBSERVATION_2),
ULearningAgentsObservations::SpecifyFloatObservation(InObservationSchema, 1.0f, OBSERVATION_3)
});
}
void UCrashyInteractor::GatherAgentObservation_Implementation(FLearningAgentsObservationObjectElement& OutObservationObjectElement, ULearningAgentsObservationObject* InObservationObject, const int32 AgentId)
{
OutObservationObjectElement = ULearningAgentsObservations::MakeStructObservationFromArrayViews(InObservationObject,
{
OBSERVATION_2,
OBSERVATION_3,
},
{
ULearningAgentsObservations::MakeOptionalNullObservation(InObservationObject, OBSERVATION_2),
ULearningAgentsObservations::MakeFloatObservation(InObservationObject, 1, OBSERVATION_3),
});
}`