I run the game everything works fine.
I Stopped the game and play it again, the editor crashed the out of bound error.
Array index out of bounds: 99 from an array of size 99
for (auto& SpawnArrayElements : ItemsIDArr) // array can store 100 elements (0, 99)
{
SpawnType = SpawnArrayElements.Type;
SpawnID = SpawnArrayElements.ID;
ItemGroupRef->GetAllTransforms(Available); //array has 5 transforms elements
RandomLocation(Available, Location);
if (UsedLocations.ContainsByPredicate([Location](const FTransform Transform)
{
return Transform.GetLocation() == Location.GetLocation()
&& Transform.GetRotation() == Location.GetRotation()
&& Transform.GetScale3D() == Location.GetScale3D();
}))
{
RandomLocation(Available, Location);
}
else
{
RandomLocation(Available, Location);
SpawnLocation = Location;
UsedLocations.Add(SpawnLocation);
}
}
ItemsIDArr.Empty();