UE Reflection - how to get Type of TArray elements?

anonymous_user_590cb5931
Fri, 15 Apr 2016 12:36:57 +0000
Rendering

Hello.
How to get Type of TArray elements with UE reflection?
For example, I have some array:

    UMySaveGame* save = Cast<UMySaveGame>(UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()));

    TArray<FString> sa;
sa.Add(TEXT("TEXT0"));
sa.Add(TEXT("TEXT1"));
sa.Add(TEXT("TEXT2"));
save->MyStrArrProp = sa;

and I want to access it with the reflection:

UClass* SourceObjectClass = save->GetClass();
	TMap<FString, UProperty*> Props;
	for (TFieldIterator<UProperty> PropIt(SourceObjectClass, EFieldIteratorFlags::SuperClassFlags::IncludeSuper);
	PropIt; ++PropIt)
	{
		Props.Add(*PropIt->GetNameCPP(), *PropIt);
	}
for (auto p : Props) {

GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green,
				TEXT("PROP NAME: ") + p.Key +
				TEXT(" - TYPE: ") + p.Value->GetCPPType()
				//TEXT(" - VALUE: ") + (*ValuePtr)
				);
}

It shows only TArray for p.Value->GetCPPType() . But how to check, what type of values of that TArray?
Ie, it can be, for example TArray.

Thank you!

3 posts - 2 participants