How do I find a component by name?
I want to define a position within my Pawn actor for something to float in front of the actor. It doesn't have to be a rigid attachment like a socket, so I don't mind if it is slightly off every frame.
Firstly I can't find any function such as GetComponentByName()
Secondly, i've tried using some of the components that let you transform and rename them, such as an ArrowComponent or a SceneComponent, and changing their name. I can't work out how to retrieve that name in code! I've tried GetName() but this doesn't match the name I've edited, and looking through the header files I can't find the variable that corresponds to the set name.
Can anyone help? Am I doing this wrong?
EDIT: It seems that there is no inbuilt way to do this, and the only way to do it is to create your own components or to retain a link to the component when you create it.
you can make your own component, and give it the name variable you want,
wiki tutorial: Custom BP-friendly UObject Components
then you can find it by doing this
answered Jul 16 '14 at 07:51 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here