What is the most simple way to communicate with an actor of a level from a blueprint which is not the level blueprint?
For example I put a cube to a level. And script a blueprint (which is not the level blueprint) which can somehow trigger to move that cube in the level. So is this possible, and if so, how?
You can use the GetAllActorsInClass node, it’s a bit cumbersome but it will get you what you need. This will get all the actors of that class in that level. But TBH, you should be using the Level BP also, there’s a reason why it’s there. You can easily get the proper reference to that object and trickle that down to your other blueprints. Other options include:
Hello Victor, thanks for the answer. I had seen GetAllActorsInClass node and also the other options you mentioned. But sadly couldn’t figure out how to execute them. For example that node has an area to select a class. I don’t know what class to select for there. Also I don’t know how to make one specific actor in the level move.
And by cumbersome do you mean that taht node reduces the performance of the game?
That particular node does come at a performance cost, so using a lot of those is not recommended. One or two, you could probably get away with it. Maybe even more, depending on how often those were getting called. But generally, you would want to actually learn how to reference objects correctly.
Good luck, this will help you out doing exactly what you need. If this has answered your question, please upvote and mark as answered so we can close this out appropriately.
As Victor said, there is the Get All Actors of Class. And while it appears to be a “blanket” call that returns far more “actors” than one wishes. That is really up to you, when you create your blueprint, you will be selecting the Actor class, but that doesn’t mean, to find this blueprint, you have to ask for the “actor class”. The blueprint becomes a subclass, that you can get specifically, filtering out all the other actors. So just ask for that class in the drop, or a variable that you set up with the class then plug into the node.
Honestly, UE4, is very flexible, and you can twist it a million different ways.
Thank you both. Victor, the second video looks very helpful. Though I haven’t watched it till it’s end I think I will have the answer there. I will now accept your answer but if I’ll have further questions I hope you will look into them as well.
Finished the video. The best way for me seems to be the Event Dispatchers. And the reason I am avoiding using the level blueprint is that I am planning to make an open world game and the last time I did it, the level blueprint became so huge when you zoom out to the max still it was never ending to scroll from one side to another. And it was taking too much time to open, compile or save it. But in the video you recommend, he is teaching to make macros and other things to keep the blueprints cleaner.
does getallactors return all actors in the entire world or in the level? I assume its in the world, if so is there a method to sort by sublevel or should we just tag things ourselves for this purpose?