Casting Blueprints Question
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.
My casts are failing. How can I fix this?
Also, I have an error an unrelated error right here:
what does this mean and how can I fix this?
To fix this I created a variable referencing to each of these blueprints and then I could get their locations.
According to this ( https://answers.unrealengine.com/questions/150506/make-custommeshtriangle-warnings.html?sort=oldest ) thread, it should be removed in a future update.
answered Dec 28 '14 at 04:24 PM
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.
answered Dec 23 '14 at 04:35 PM
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.
answered Dec 25 '14 at 05:54 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here