I’m testing around with creating/initializing components during runtime but found that the components aren’t attaching at all and I don’t know why?
Currently using this:
void AMainCharacterTesting::Test()
{
if (!TestArrow)
{
TestArrow = NewObject<UArrowComponent>(this, "TestArrowComponent");
TestArrow->RegisterComponent();
TestArrow->SetupAttachment(Camera);
}
}
Thanks in advance.
3dRaven
(3dRaven)
2
SetupAttachment can only be called in the constructor (CDO)
You can use AttachToComponent
So
TestArrow->AttachToComponent(Camera,FAttachmentTransformRules::KeepRelativeTransform)
Ofc you can have more refined control with the FAttachmentTransformRules as a parameter and set it more in depth.
system
(system)
Closed
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.