Hello !
I’m trying to make a CameraManager component, which would automatically create and attach a SpringArm and a Camera to its parent Actor.
I got some answers from here thread but no luck so far.
I tried
USpringArmComponent* SpringArmCT = NewObject(GetOwner(), USpringArmComponent::StaticClass(), “SpringArmCT”);
if (SpringArmCT)
{
SpringArmCT->RegisterComponent();
SpringArmCT->AttachTo(GetOwner()->GetRootComponent());
}
but it doesn’t work, the component doesn’t show up at runtime.
I tried SpringArmCT->OnComponentCreated(), SpringArmCT->InitializeComponent(), but it still doesn’t work
Any help pls ? thanks
Edit : I also tried
USpringArmComponent* SpringArmCT = NewObject(GetOwner(), TEXT(“SpringArmCT”));
if (SpringArmCT)
{
SpringArmCT->SetupAttachment(GetOwner()->GetRootComponent());
SpringArmCT->RegisterComponent();
}
and some other variants lol … nothing works. And btw I call this from the component BeginPlay.