Your MyRowNames_Acc should be of type TArray<FName>, so did you set this one correctly?
If so, this is already an array, you do not really need to check for âif (rownames)â. A check for the array size could be done, I added this below: ârownames.Num()â. But it is not needed, as the iteration in the for loop will handle this.
Hereâs some working example, just printing the row namesâŚ
LoadingScreenDatatable = LoadObject<UDataTable>(NULL, TEXT("DataTable'/Game/Henry/DataTables/DT_Test2.DT_Test2'"));
if (LoadingScreenDatatable)
{
TArray<FName> rownames = LoadingScreenDatatable->GetRowNames();
if (rownames.Num() > 0) // not really needed to check!
{
for (auto& ArrayElement : rownames)
{
UE_LOG(LogHerb64, Display, TEXT("Rowname: %s"), *ArrayElement.ToString());
}
}
}
This âArray has changedâŚâ error happens, if you change the array content while iterating over it. I looked at your code - indeed, you add items within the for loop.
You could try to iterate with a for (i =âŚ) loop to avoid these issues.
See this forum thread.