Download

Cannot implement constructor because defined in generated body

Hi, I am using a subclass of UAnimInstance, problem is the generated code for that subclass is specifying a constructor so I cannot implement a constructor for my subclass. Commenting the line in the .generated.h and implement my own constructor just doesn’t work as the file is regenerated at each build.

here is an extract of the MyAnimInstance.generated.h file:



(...)
#define prj_4_17_Source_prj_MyAnimInstance_h_15_ENHANCED_CONSTRUCTORS \
	/** Standard constructor, called after all reflected properties have been initialized */ \
	NO_API UMyAnimInstance(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()) : Super(ObjectInitializer) { }; \
(...)


Found the answer here in case it helps others: I just need to declare UMyAnimInstance() in my header file and implement UMyAnimInstance::UMyAnimInstance() in .cpp file as a regular default constructor. The UE scripts apparently check this and prevent their own overrides in that context.