Adding Meta to Blueprint Variables

Hey guys,

Is it possible to add properties to Blueprint variables in the editor?
I want to add a flag that indicates whether a value should be database serialised and another flag that indicates if a value should be included in debugging information, but so far it’s been elusive to add meta properties!


Hi! You can use custom metadata with functions, classes and properties till you using C++ code. To use this you have to add your custom meta directly to UCLASS\UPROPERTY\UFUNCTION Meta block


This meta value will be attached to the property and you will be able to get it using UProperty::GetMeta or check presence of a meta flag using UProperty::HasMeta. To extract meta from object instance you can use GetClass() first. It will give you a reference to the Class object associated with your c++ class. This object contains functions like FindProperty, which allow to find a property by it’s name. If you get UProperty reference somehow it’s easy to get an associated meta - UProperty references contain GetMeta function.

UClass* CheckClass = SomeUObject.GetClass();
UProperty* CheckProperty = CheckClass.FindProperty(TEXT("SomeProperty"));
FString CustomMeta = CheckProperty.GetMeta(TEXT("CustomMeta"));

thanks for the answer! i’ve clarified my question a bit since i realised i only put editor in the tags. do you know if it’s possible to add meta to properties that are variables in blueprints in the editor?

Unfortunately I have no idea how to use custom meta without c++. If you don’t have a c++ based module in your project I even have no idea how do you want to make a custom serialization. (There is no exposed to the blueprint serializers as I know). If you have a c++ module but just want to mark fields directly from the blueprint editor you can use blueprint details modifiers. They affects all blueprints but they should be registered from the c++ code too.

	// Register Blueprint editor variable customization
	FBlueprintEditorModule& BlueprintEditorModule = FModuleManager::LoadModuleChecked<FBlueprintEditorModule>("Kismet");
	BlueprintEditorModule.RegisterVariableCustomization(UProperty::StaticClass(), FOnGetVariableCustomizationInstance::CreateStatic(&FControlRigVariableDetailsCustomization::MakeInstance));

Example of how it works you can find in the engine sources: UE_4.17\Engine\Plugins\Experimental\ControlRig\Source\ControlRigEditor\Private\ControlRigVariableDetailsCustomization.cpp

This modifier adds some extra checkers for some variables and extends meta like you want to do.

Doesn’t seem to be possible right now.

Edit: asking this elsewhere, hoping for updates soon!