this is my code
In your BP it looks like the camera boom and camera are children of the mesh. You’d want the desired camera to be a child of the camera boom
that tend to happen if you’ve created your bp and then changed the attachment of the camera in cpp. so ue serializes the parenthood differently.
go to the bp, change the parent to an actor, then change it back to the cpp class.
thanks for sharing the code. it was helpful.
also share the header please, to ensure you have the appropriate uproperty tags (readonly and visibleanywhere)
Thats my header, I changed to ReadWrite to see if it would let me change the heirarchy of the Components and attachments in the BP.
how would I change the parent?
Would this also mean i have to change the parent class every time i want to add/remove components from the cpp file?
The ADS camera doesnt need to be attached to a camera boom as its a first person view, i need the ThirdPerson camera to attach to the camera boom but when i attach it, it doesnt seem to attach in the BP
readwrite can be confusing.
readonly is recommended, since it means that you can’t make the pointer point to another object. and yet you can still access and modify the object.
also i recommend to initialize to nullptr and maybe use TObjectPtr instead of Uxxx* (though this “should” not affect you much).
nopes. it only happened because you changed the parent of a component with another one.
in my experience that change tends to get screwed.
maybe there’s a way to fix it in cpp or bp but i don’t know of it.
maybe by making the component reparent correctly on the bp constructor (make sure you call the parent constructor (right click on the function name node > add call to parent)
to reparent use this How to change parent class of blueprint asset? - #3 by IphStich
blueprint change parent at DuckDuckGo
yups. i understand. i still think is the issue we’ve discussed.
Can you try without the AttachToComponent call ?
SetupAttachment should be enough.