Download

Blueprint references vs event dispatchers

I’ve seen Unreal Engine lectures where people say that you should try to keep the number of other blueprint actors/classes your blueprint references low, because they’re always loaded into memory if you do that.

One way around that is interfaces, and another is apparently soft references (although I’m a bit hazy if that applies here or not).

But when it comes to event dispatchers, you must hard reference an object and cast to a class… which feels sort of backwards if you have an event you want to spread across a wide variety of objects?

Aren’t you going to get super reference heavy blueprints if you do a lot of event dispatching and binding?

Not necessarily, because other actors would ideally load only one actor’s pointer address and bind to its event dispatcher one time on load. So there are only other existing actors with a reference to one existing actor. It’s all pointers, so it shouldn’t be too bad.

The inverse has one master blueprint with references to other actors to call events on - this is where things can get heavy because those other actors may not need to be loaded at any given time, but if the master blueprint references them, they must be loaded.

Soft references are a good way to go about it as long as the actors you need to load in aren’t too heavy (otherwise you end up with hitching). This way they’re only loaded when you absolutely need them. Just design with that in mind (that is, don’t load them into hard references until you need to) and avoid doing too much in one frame.

That said, if everything is loaded into your level already anyway, a bunch of hard references in a non-issue. Depends on your game, what you need to load and when, how many references you will indeed need, and how heavy those actors are.