How to add metadata to a map

I feel like I’m trying to achieve a very simple thing but can’t find a way how to make Unreal do it.

For every map (world/level) I’d like to have some config variables which I’d like to access before the player loads it from a dynamic map selection in main menu. (Mostly importantly MaxPlayers, specifying how many spawn points are there, to show appropriate number of player slots in a game lobby)

Basically load some data/metadata from the Level file while being in another level (main menu).

I tried adding game tags to the map and reading them with Asset Manager, or finding a way to cast to the map’s blueprint, nothing worked.
I’d like to avoid making a list of all maps and additional files for something that simple, a single variable which should be directly tied to the map file.

Thanks for any ideas.

Hi! I am sure that you can do it with something like this:

  1. First of all create special mapping asset, i.e. UDataMapping, where you can store your data for each UMap in some UProperty, for example TMap

  2. After that you can override UGameInstance class and create a singletone from it. We can name it UYourGameInstance

  3. Add UProperty of UDataMapping* in UYourGameInstance. Now you can create Blueprint around it and select UDataMapping from selector

  4. At last create special methods in UGameInstance to get the data from mapping asset. So, you can get data without the need to load map

Thanks, that sounds like what I need, but unfortunately I would have to learn C++ to even do the first point on your list. Meanwhile I’ve found a solution which is fairly straight forward, although it requires an additional file. I’ll post it as an answer.

I have found a tutorial on Data Assets, which can be used with blueprints and do almost exactly what I needed here.
Here: HTF do I? Blueprint only Data Assets in Unreal Engine 4 ( UE4 )