Search code examples
meshunreal-engine5

AttachTo: "root component cannot be attached to other component in the same actor" when trying to spawn weapon at character socket


I'm pretty new at Ue5. I tried to follow a YouTube tutorial about making FPS game with Unreal Engine. I'm now stuck with an error when trying to spawn a weapon at my character newly created socket.

My newly created "WeaponSlot" Socket: enter image description here

The code: enter image description here

Error log: enter image description here

From what I noticed, the only difference in code is "AttachTo" function, it should be "AttachToComponent". But there is no such function.

enter image description here

I'm super new to Unreal Engine. Any suggestion, or maybe another method to spawn the gun is highly appreciated.


Solution

  • I found the answer. You have to return target actor like so : enter image description here