C++ custom property flags?

If possible, I want to be able to make a property flag you can toggle like a boolean and if I can, try to get all the variables and components with the property flag and have a reference to them. How would I make a property flag? It’s for a plugin I’m making. I want the flags to show on any components and variables. If this isn’t possible I would appreciate it for an alternative equivalent, or at least as close as possible. Thanks!

Yes, you can not add new specifiers as they are hard coded in to UHT, but you can add new meta specfiers… in fact you dont need to add as meta specfier accepts any specfiers and register them which later any code can read.

Same as every class have UClass, every property have a UProperty and you can access it as described here:

And not only you can read variable state, you can also read meta specfier

And it not just feature of UProperty but all UFields, so UClass too for example which is a lot easier to access.

Great! Is there a way I could use this “specifier” in every variable and component, and be able to disable and enable it like a boolean and still be able to add this in my plugin? Thanks!

Objects don’t have specifiers so you would need to add specifier to variable containing a component, it’s common practice in UE4. for objects you can also use tags:

But if you want it to be usable in C++ use specifiers insted

You can check if meta specifier exist and then you can read value out of it, but 2nd is optional. So if you say you want bool then just check if specfier exists like this:

UPROPERTY(EditAnywhere,meta=(MySpecifier))

Then in code you can check once you got UProperty

MyProperty->HasMetaData(FName("MySpecifier"));

Again meta specfier will accept anything, you can write whatever you want in there, then with code you can read what property had in specifier

2 Likes

Thanks, I’ll be posting a new question that will be something related to this, the reason I’m posting a new one is because I have a few questions posted which i’m going to delete and summarize them in one. EDIT: Heres the link: “https://answers.unrealengine.com/questions/989045/c-large-save-system-help.html