Make a custom SpringArmComponent

Are you trying to define a C++ class that extends SpringArmComponent, or trying to create an instance of it that shows up in blueprints?

Hello internet, I need help doing this. I am experienced in C++ but not so much working with C++ and Unreal together. I need to make a custom spring arm component that can move and rotate around freely. I have already made my own custom SpringArmComponent, but something is horribly wrong. At runtime, the component is a nullptr and it returns no value though it does appear in the blueprint editor. Something’s missing… but what?

Did you decorate the member declaration with the UPROPERTY() macro e.g. in the class where you’re creating an instance of it?

UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UPWNSpringArmComponent* CameraBoom;

Otherwise it will be garbage collected and result in a nullptr.
At the risk of stating the obvious you also need to actually create it, e.g. in your constructor:

CameraBoom = CreateDefaultSubobject<UPWNSpringArmComponent>(TEXT("CameraBoom"));