Why the engine crashed on play ? TArrays Related

Hi, how can I add the returning value in ItemsIDArr Array?

what I am trying,


`void RandomItemID(EItemType ItemType, FST_ItemsIDandType& Item);`
`void AddRandomID();`

void AMyTestActor::AddRandomID()
	TArray<FST_ItemsIDandType> ItemsIDArr{};
	FST_ItemsIDandType LocItemID;

for (auto& Array : ItemsTypeArr)
		RandomItemID(Array, LocItemID);

the problem is the engine crashed when clicked play.

your for loop is fine this is not the reason of the crash, you may have infinite loop under the Randomitemid() function

hope it helps,

1 Like

Sir thank you for reply, this function has 254 lines of code :tired_face: and i have no other option instead of re checking each line