if it runs with in the sequence of 2 steps it freezing the engine only if the logic implemented in pure C++. First i wlll show the blueprint with sequence and then C++ code which is freezin the engine.
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.
in your .cpp replace do/while loop at //Sequence 1
} while (TransformsEqual(Available, Location));
SpawnLocation = Location;
locations are itself unique, the containers transforms are itself unique.
I already takes a unique Location from the array of random range Location = Available[FMath::RandRange(1, Available.Num() - 1)]; UsedLocations.Add(Location) // used for future checks if to know the location is used and can’t be duplicated SpawnLocation = Location
the next time it loops it make new random range by -1 if duplicated range, repeat randomizing.
as you can see everytime the mesh should take a new unique location to be spawned.
in blueprint the logic works becuase comparing memory behind the scene to unique address , but in C++ the loop goes just infinite and the engine freeze.
in unreal C++ FTransform don’t have a find function like in blueprint , I can’t make UsedLocations.find(Location) == -1 this is the main problem of the issue, I don’t know why the dev’s missed it… I don’t know how to overload my own method operator somehow