Hello Unreal,
My question is pretty simple. I actually have a piece of code for a C++ actor which I need to repeat, and I’m wondering if there’s a way to make some templated UPROPERTY declarations so I can group my piece of code in a single class.
A little illustration of what I’m trying to achieve, with the piece of code I’m trying to repeat. Basically, the user gets to select a value from an Enum, and depending on the value they picks, they can set one object/value in editor :
UPROPERTY(Category="Category", meta=(ToolTip = "Enum to pick which object to use")
TEnumAsByte<EEnumChoice> EnumChoice;
UPROPERTY(Category="Category", meta=(ToolTip = "Object to use if choice is 1", EditCondition = "EnumChoice == EEnumChoice::EE_C1", EditConditionHides)
UObject* Object1;
UPROPERTY(Category="Category", meta=(ToolTip = "Object to use if choice is 2", EditCondition = "EnumChoice == EEnumChoice::EE_C2", EditConditionHides)
UObject* Object2;
UPROPERTY(Category="Category", meta=(ToolTip = "Object to use if choice is 3", EditCondition = "EnumChoice == EEnumChoice::EE_C3", EditConditionHides)
UObject* Object3;
If it weren’t for the UPROPERTY macros, I could have simply wrap these lines in a class, but my problem if I do this is I can’t find a way to specify a category or a tooltip for each object. More precisely, I have to use this structure for different physical parameters (Pressure, temperature, etc) and I would like to specify in the different tooltips the units used (hPa for pressure, celsius for temperature, etc) and use different ClampMin and ClampMax values (0,2000 for pressure, -60,60 for temperature, etc)
So I was wondering if there was a way to somehow use variables or parameters for UPROPERTY specifier values, so I can just create a class and instanciate some objects with the options needed.
Thanks in advance !