Randomize Array of FTransform and compare if the elements are duplicated C++?

The issue is, like others have mentioned that transform in UE doesn’t have a binary operator, so the array internal functions Find or Contain cannot compare each element to the one you want to search for.

If you really want to do it that way, then you can use something like this:

if (UsedLocations.ContainsByPredicate([RandomLocationOut] (const FTransform Transform)
	{
		return Transform.GetLocation() == RandomLocationOut.GetLocation()
			&& Transform.GetRotation() == RandomLocationOut.GetRotation()
			&& Transform.GetScale3D() == RandomLocationOut.GetScale3D();
	}))
{
     // Your then code here
}
else
{
    // Your else code here
}
1 Like