Hi, to speed the progress I will post the image of the blueprint and the C++ code I am already trying
BP
Code
void ATestActor::PrintElements(EItemType& ItemType)
{
TArray<EItemType> Arr{}; //UEnum type
TArray<FName> OutRowNames{};
if (const UDataTable* DT_ItemTypeProbability = LoadObject<UDataTable>(NULL, TEXT("/Game/DataTables/ItemsGeneration/DT_ItemTypeProbability")))
{
OutRowNames = DT_ItemTypeProbability->GetRowNames();
for (auto& Array : OutRowNames)
{
if (const UDataTable* DT_ItemTypeProbability{ LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/ItemsGeneration/DT_ItemTypeProbability")) })
{
if (const FST_ItemTypeProbability * OutRow{ DT_ItemTypeProbability->FindRow<FST_ItemTypeProbability>(FName(Array), "") })
{
if (OutRow)
{
TypeProbabilityDatas = *OutRow;
for (int32 i = 1; i <= TypeProbabilityDatas.Percent; i++)
{
Arr.Add(TypeProbabilityDatas.Type);
}
}
}
}
}
for (auto& Array : Arr)
{
UE_LOG(LogTemp, Warning, TEXT("%c"), Array);
}
printf("_____________");
ItemType = Arr[FMath::RandRange(0, 99)];
}
}
Problem
unable to print the correct data from Array
Details
expected correct data from data table.
but printed the unreadable incorrect data.
Data Table:
DT_ItemTypeProbability