C++ UE5 AttachToComponent(RootComponent);

Hello everyone I’m currently stuck in a little problem and i dont know what to do

it seems that AttachToComponent(RootComponent); don’t work anymore seens i got to UE 5.0
Screenshot_20230226_042854
VS2022 says :
“‘USceneComponent::AttachToComponent’: function does not take 1 arguments”

can anyone help me?

thanks in advance.

hI @Scholars_Heaven

Not sure if it has changed but there are 3 arguments?

AActor::AttachToComponent | Unreal Engine Documentation

1st 2 are mandatory i believe socket is optional

thanks I’ve tried this too but still not working

is the error the same? can you post an image of the log filtered by errors?

here is it :

so have you found each one of those references (5 if i counted correctly) and added in the 2nd none optional parameter?

Also error C4458 you may possibly have named a variable and a class member with the same name which isnt good in practice. But it may still compile.

Nope theres 6 not 5! :rofl:

well I don’t know what to do so…

here is the code :
ProceduralPlanet.zip (16.9 KB)

you need to add transform rule like this

CaptureComp->AttachToComponent(CameraComp, AttachmentTransformRules::KeepRelativeTransform);

1 Like

thanks i will try it right now.

well done you beat me to it was just going to paste it!

beat you?

i was replying to @ugmoe he beat me to the code he posted

ah, sorry.

but still thanks now it seems to work.

(it has now popped out new errors :joy:)

1 Like

Always does my friend :rofl: :rofl:

Good luck, if its a new error post away!

welcome to programming :laughing:

thanks :joy: