How to select value for FName uproperty from array of FNames by dropdown list in editor details?

I have an actor class which have a FName UPROPERTY and also an array of strings loaded from config. I need to select a value from that array in editor details of that actor and assign it to that property instead of entering that string manually.

I need the same behaviour as UENUM value selection but for FName.

How to do it?

GetOptions specifier is exactly what you need

2 Likes

Wow! Looks like that is what I seeked. But I have a problem with it.

The textfield is converted to combobox but when I open it there is no any options in it. And I can’t select anything. Also, I don’t see this specifier in the official Unreal documentation Property Specifiers | Unreal Engine 4.27 Documentation

UE 4.26

Can you give me a short source example how to do what I need. I tried to use it but I can’t understand. It is too complicated.

And also, I’m not making module, just a class in general game code. How to register customizer for class instead of module?

The function that I set here is not calling.

It’s working in game (if I press F8), but not working in editor

I found what was wrong. I needed to add CallInEditor to the options function:

UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (GetOptions = "GetNameOptions"))
FName Name;

UFUNCTION(CallInEditor)
TArray<FString> GetNameOptions() const
{
    return { TEXT("N1"), TEXT("N2"), TEXT("N3") };
}
4 Likes

How did you make it work? I tried, but not showing any buttons but only array