Hi! Lets say I want to use some sort of string variable in UPROPERTY macro to avoid hardcoding strings (Category=MyCat instead of Category = “My Category Name”). I tried to use const FString and #define yet both lead me to the point where Uproperty simply use the name of string/define instead of its value.
So, is it even possible in some way to use some predefined values of strings in unreal reflection macros?
Macros arguments are inserted as they are, not as a variable. Even if the uproperty category was set using another macro… macros are not a good solution. If you happen to create a macro with the same name as another plugin then the project will not compile. That would create compatibility conflicts if you wish to ship it. Best thing you can do is to define categories up front (document it). It’s not that bad if you don’t make many typing mistakes and use the right tools to scan and alter them later if you need to, like Regex and Agent Ransack.
Thanks, actually i ended up with writing empty macro with its name equal to the name of category i need. So rider can suggest me this name after equal sign. Idk how awful it sounds to other people, would really glad to hear feedback about that, but for now it helps with name substitution and quick refactoring (if needed ofc)
I will wait for a while in case some1 also will suggest something or would give feedback about empty macros as names and if nothing better will came up - i’ll mark ur answer as solution