Is there a way to run the same code on each level blueprint?

The fact that to this day we have such hard limitation on the use of the level blueprint is absolutely ridiculous.
Is there any way in which we can reuse code on each of the level blueprints without having to copy from one map to another like in the '80s?
Thank you.

Is there any way in which we can reuse code on each of the level blueprints without having to copy from one map to another like in the '80s?

You’re not supposed to be doing that to start with, otherwise you’re using the LB for something that is not intended, and in a way that is suboptimal. The whole idea of the LB is to script stuff that is unique and pertinent to that level only…


If you want repeatable script, have it in an actor and place an actor in each level. Or keep the script in the framework, game mode, game state, etc perhaps?

2 Likes

Thanks. I thought of all that.
I’m trying to save stuff in streaming levels.
Game mode, game state only work the persistent level.
For streaming levels, a “saving manager” actor in the level doesn’t do me any good if I try to save my actors states on level unload, for example, because the saving manager might be destroyed before all other actors.
Why don’t I get the actors to ‘save’ themselves? Because it gets way too complicated, and it doesn’t work for actors that are spawned at runtime.
Level blueprint works like a charm and it’s so simple to do. But I don’t want to have to copy code across ALL my levels when making the slightest change.

Yes, exactly. I want each streaming level to save its own actors only, but the code is all the same. Why is it a good idea to restrict propagating code across all level blueprints? It makes no sense.