Reference static function in meta specifier 'GetOptions'

Hello everyone ! So here is the problem :
I’m trying to show a list of possible FString for an UProperty of a custom structure
I’ve seen you can use the GetOptions = "FuncName" meta specifier to obtain that effect which I did successfully outside of a structure. But I’d like to use a static function.

As read on this website All UPROPERTY Specifiers · ben🌱ui :

GetOptions also supports external static function references via Module.Class.Function syntax. If the function name contains a ., it is assumed to be static and the editor will crash if it is not.

I tried using that technique but that doesn’t work (List is empty on selection of UProperty)

USTRUCT(BlueprintType)
struct PROJECT_S_API FSkills : public FTableRowBase
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (GetOptions = "Project_S.UDBHelper.GetAllDebuffs"))
    TArray<FString> names;

};


UCLASS()
class PROJECT_S_API UDBHelper : public UObject {
    GENERATED_BODY()


public:
    UFUNCTION(CallInEditor, BlueprintCallable, Category = "DBManagement")
    static TArray<FString> GetAllDebuffs() {
        FString name = FString("wow");
        FString name1 = FString("wow2");
        FString name2 = FString("wow3");

        TArray<FString> names = TArray<FString>();
        names.Add(name);
        names.Add(name1);
        names.Add(name2);

        return names;
    }
};

The final goal would be to provide a list for an entry in a data table

Thanks a lot !

1 Like

Hi ! I had the same problem. You need to remove the “U” in the class name. So in your example it would be : “Project_S.DBHelper.GetAllDebuffs”.

It works perfectly :slight_smile:

4 Likes

Wonderful. Saved my time. Thanks

Did you find any solution? Not being able to create dropdowns based on non enum data shouldnt be so complicated.

Perfect! Thanks! Using just ‘className.functionName’ worked for me as well.