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.
Thanks Rama, I ended up adding a new component in C++ which had a set name, and then just referencing that.
I did run into a problem adding a new component (in code) to a blueprinted objected I had already created - because the new component didn’t show up. I believe this is a known issue and has been fixed (?) in later builds. Anyway, If anyone else comes across this I ended up having to re-create my blueprint and manually transfer all of the old values I had to make the component show up.