Can I redirect a variable to an array?
i.e.: I’ve this class:
UCLASS()
void UMyClass : public UObject
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
int32 Variable{};
};
I would like to modify Variable into a list of integers and rename it in Variables:
UCLASS()
void UMyClass : public UObject
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
TArray<int32> Variables{};
};
I tried to modify the DefaultEngine.ini file of my project…
[CoreRedirects]
+PropertyRedirects=(OldName="MyClass.Variable",NewName="MyClass.Variables[0]")
… and unfortunately it doesn’t work. How can I redirect it?
I thought I could override PreSave() method and transfer Variable into Variables, then resave all assets in Unreal Editor and then remove Variable from the code, but I’m wondering if a better solution exists.