GetOptions (meta)

Makes a FString input into a combo dropdown by defining a function to use to get the options. NOTE: The function has to be a UFUNCTION!

Example

(From SHADERSOURCE: Texture Tools)

class USH_TEX_Statics : public UBlueprintFunctionLibrary
{
	UFUNCTION()
		static TArray<FString> GetSamplerNames();
}

class USH_TEX_Job_AIGeneration : public USH_TEX_TextureJob
{
	UPROPERTY(EditAnywhere, Category = "Sampler", meta = (GetOptions = "SH_TEX_Statics.GetSamplerNames"))
		FString Sampler = "euler";
}

Note: If GetOptions is used in a struct and there is no leading class name (eg, "GetAIWorkFlows" rather than "USH_TEX_Job_AIGeneration.GetAIWorkFlows", the code will look up to the struct's parent recursively until it finds a UFUNCTION definition that matches its name. That way the GetOptions function does not have to be static, it can be an instance of an object.

Reference

Last updated