I’m trying to make a simple 2d game, and am currently having problems with the FConstructor Statics syntax i think. Here is the code i have currently:
struct FConstructorStatics
{
ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> RunningAnimationAsset;
ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> IdleAnimationAsset;
ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> JumpingAnimationAsset;
FConstructorStatics()
: RunningAnimationAsset(TEXT(“/Game/2dSideScroller/Sprites/newAnim/Running.Running”))
, IdleAnimationAsset(TEXT(“/Game/2dSideScroller/Sprites/newAnim/Idle.Idle”))
, JumpingAnimationAsset(TEXT(“/Game/2dSideScroller/Sprites/newAnim/jump.jump”))
{
}
};
static FConstructorStatics ConstructorStatics;
RunningAnimation = ConstructorStatics.RunningAnimationAsset.Get();
IdleAnimation = ConstructorStatics.IdleAnimationAsset.Get();
JumpingAnimation = ConstructorStatics.JumpingAnimationAsset.Get();
This works fine for Running and idle, although the JumpingAnimation=… line gives me errors and i have no idea why. Errors include JumpingAnimation is undefined, and another one that says JumpingAnimation: undeclared identifier.
I initialized it and called it the exact same way i did running and idle, what am i not understanding?