Is there any way to use templates/generics on USTRUCT objects (or even UCLASS)?
For example, something like the following:
USTRUCT(Blueprintable, Category = "Scripting|Remote Character|Attributes")
template<typename Type>
struct FRemoteCharacterSubAttribute
{
GENERATED_USTRUCT_BODY();
public:
FRemoteCharacterSubAttribute() {
Name = FString(L"Unassigned");
BaseCost = 0.0f;
}
UPROPERTY(BlueprintReadWrite, Category = "Scripting|Remote Character|Attributes")
FString Name;
UPROPERTY(BlueprintReadWrite, Category = "Scripting|Remote Character|Attributes")
float BaseCost;
UPROPERTY(BlueprintReadWrite, Category = "Scripting|Remote Character|Attributes")
Type MinValue;
UPROPERTY(BlueprintReadWrite, Category = "Scripting|Remote Character|Attributes")
Type Value;
UPROPERTY(BlueprintReadWrite, Category = "Scripting|Remote Character|Attributes")
Type MaxValue;
};
… And then you would use it like:
USTRUCT(Blueprintable, Category = "Scripting|Remote Character|Attributes")
struct FRemoteCharacterAttributes
{
GENERATED_USTRUCT_BODY();
public:
FRemoteCharacterAttributes() {
fMovement.Name = FString("Movement");
fMovement.BaseCost = 10.0f;
fMovement.MinValue = 50.0f;
fMovement.MaxValue = 500.0f;
fMovement.Value = fMovement.MinValue;
}
UPROPERTY(BlueprintReadWrite, Category = "Scripting|Remote Character|Attributes")
FRemoteCharacterSubAttribute<float> fMovement;
};
Any way to make this happen?