Download

Acessing the Level Blueprint

Hi.

How can I access the Level Blueprint the most elegant way?
I want to retrieve Data from it. The Level Name for example (I have a different Level Name than the Filename).

Are you looking for just general level information?

In that case, go to EDIT -> Project Info/Settings.

The Level Blueprint is for something entirely different.

Get Current Level Name is a node in Blueprints.

I got a workaround. I created a separate Actor “LevelInfo” which contains the Level specific data.

GameMode searches for this Actor in BeginPlay and stores it’s values.

There is no “normal” way to access the Level Blueprint. It’s not meant to be accessed.

If you have information about your Level, you can totally work with a “LevelInfo” actor (Note: You can let the LevelInfo Actor register itself
on the GameMode by using “GetGameMode” and filling the Data in by himself on its BeginPlay. That removes the need of searching and
also removes unnecessary code from the GameMode).

Another way would be using the GameMode directly and just give him a Struct of LevelData.
Or you could create a Custom Blueprint Actor Component, which you give the GameMode. So you have it at the right place, but
it’s still its own Actor.

I absolutely forgot that. Thanks :smiley:

But then I have to create subclasses of this GameMode. Which is imo not the purpose of a GameMode to have multiple variations(= per level) of it :wink:

Yeah right, one GameMode per Level, but I don’t see why you would need different GameModes for this.
Even if you do, you can specify the GameMode on Level Load. So you can change it RunTime if necessary.

But even if not, Components can be spawned runtime, so you could spawn it instead of setting it up pre-runtime.

LevelInfo Actor is a good solution too though.