User Defined Structure Property names appear mangled on reflection

I’m using reflection with User Defined Structures (created in Blueprint) and am finding that when iterating through the properties, they all have extended names. For example, “Foobar” as seen in the editor, reads back as “Foobar_1_b24e4343a32434fe343434” from the UProperty.

I’ve taken the tactic of chopping back the extra information - but wanted to know if there was a correct way to read back the property names.

I iterate through the structure like this:

for(TFieldIterator<UProperty> PropIt(StructProperty->Struct); PropIt; ++PropIt)
{
    UProperty* Property = *PropIt;
    // Property->GetName() here returns "name_1_1fe456ef5e6ea7b7bc" instead of "name"
   ...
}

It’s not a major problem, since the workaround appear to be “chop back two underscores”, but that feels a little ugly.

I have same problem = =#

me too since GetDisplayNameText is not valid in non #WITH_EDITOR builds

I have some problem too

Use the UStruct::PropertyNameToDisplayName or UField::GetDisplayNameText functions, in which case your example would look something like this:

auto Struct = StructProperty->Struct;
for(TFieldIterator<UProperty> PropIt(Struct); PropIt; ++PropIt)
{
     auto Property = *PropIt;
     auto DisplayName1 = Struct->PropertyNameToDisplayName(Property->GetFName())
     auto DisplayName2 = Property ->GetDisplayNameText().ToString();
    ...
}

Hey everyone, see my answer to the question, that should help you out.

Thank you very much good sir - marked as the correct answer.