I’m currently using the Cable Component for my project, and am trying to use the SetAttachEndTo method in my code.
The method requires two parameters: an AActor and an FName that is the name of the component to attach to.
I am stuck in that I am not sure what to put for the FName of the component I would like to attach to, I.E. the root component of my input Actor. Anyone have any experience with this type of parameter?
Every component attached to an actor in the world will have an FName. To get the root component’s FName, use the method GetDefaultSceneRootVariableName(). So your final code might look something like:
,I am having a lot of problems with this function, it simply does not work, no matter witch actor I provide or what FName, I spawned in c++ a CableActor and tried, do not work, verstion 4.21.2
It’s late, but to those who are going on a journey.
The second parameter is the name of the component you want to attach.
For example, in my case, I wanted to attach it to the mesh component of the weapon I was creating.
I tried debugging GetDefaultSceneRootVariableName() and nothing worked because it only returned “DefaultSceneRoot”.
So, I took the name of MeshComponent and since it is a String, I converted it to FName and applied it.