Hi!
How can I assign a component as a reference in the field of another component of the same Actor?
In the editor, not at begin play, not doing any on construct stuff or overriding anything that would make me write and mantain code for each field. Pretty much the same functionality but instead of looking in the scene for the component, look in the actor itself…
Image: i want to put components in green at the green location inside the purple component. All within the same actor.
Thanks <3
2 Likes
This may not be possible, not the place here to explain as I don’t have the exact explanation figured out myself. I’m sure a more advanced unreal c++ programmer can give the reason why. what I’ve figured out that is related with the fact that in the level, when you add that blueprint which has the components, those components are instanced, all have different names, with a number after, not like in the original blueprint. So it may be that the blueprint can’t keep track of this instance objects before starting the game.
anyway, in the AC_ViewController_Hero, write some code to search for all components of a certain type attached to the owner, then add them to the correct fields. This way the controller component can populate the variables itself regardless of what actor is attached to.
you can add tags to the springs to find them easier, or get them by name, whatever works best for you