As an almost completely inexperienced developer trying out Blueprint I found it hard to wrap my head around why I just couldn’t drop in a reference to another actor in a Blueprint and trigger custom events/get variables etc from it, 'til I got it explained. The reason being, if there are multiple actors of the same class in the level Unreal need to know which one to deal with. So this is how I go about it right now whenever I need to communicate with another class from a blueprint:
If there are multiple actors of the same class, I get all actors of the class, which makes an array (Which, as far as I have gathered, is just a list of all the actors in the level, with the first one created having the index of 0, the second one 1 etc, someone correct me if I’m wrong), plug that array into an ForEachLoop, cast to the class and trigger the custom event to each actor in the array.
If there’s just one actor of that class in the level, it’s index will be 0, so get a reference to that actor in the array, cast to the class and trigger the custom event.
Now this works fine, all I want to know is if there is a better way to do this. In the tooltip for the “Get All Actors From Flass”-node it says “This is a slow operation, use with caution”. Now that might not be something to worry about in my small test levels, but say in a full game, will using that node frequently cause some performance loss?
One thing I haven’t looked into much is Blueprint Interfaces, so my answer might just be there.
Sorry if this is somewhat unclear, communicating between Blueprints is just the thing I’ve had the most problems wrapping my head around, so I just wanna make clear I’m going about this the right way!