Blueprint to C++ and Engine Freezing?

the reason for the freez is is because the loop is always infinite since you are not giving a random range before comparing not returning any results to make the condition change in the loop.

in your .h file

bool TransformsEqual(TArray<FTransform> TransformArray, FTransform B)
{
	for (FTransform A : TransformArray)
	{
		if (A.GetScale3D() == B.GetScale3D() && A.GetLocation() == B.GetLocation() && A.GetRotation() == B.GetRotation()) 
//in your blueprint you are using only location your previous post defines, so you can check here only for location and scale in case.
		{
			return false;
		}
	}
	return true;
}

in your .cpp replace do/while loop at //Sequence 1

do 
{
  RandomLocation(Available, Location);
  UsedLocations.Add(Location);
} while (TransformsEqual(Available, Location));
SpawnLocation = Location;

test it


hope it helps
cheers!

2 Likes