Hello, I’m just simply trying to get the location of an actor from within another actor.
This is my code. I’m specifically trying to get the location of three different ‘markers’ and set them into an array.
Are the ‘marker’ locations all related to the same actor or are you trying to get the marker location of three different actors? One option would be to use the “Get All Actors of Class” node and connect it to a “ForEachLoop” node. From the Array Element pin of the loop node you then cast to the actor class you want to access. Keep in mind that the variable needs to be public (eye icon should be open) in the blueprint you are trying to access.
Personally, I would use interfaces. However, that requires that you know and can get a reference to the target actor. If you can, then interfaces are so much easier, not to mention neater, than casting. I think of casting as more of a one off thing for something that you don’t ever expect to need to do again.
My personal best guess to do with the set up you have though would be to insert a set node (to a local var) in between each cast node, and then pipe them all into the struct with a get node. it may sound silly, but I have noticed weird things with the way UE4 handles chains like this, and for me, setting local vars has worked so much better.