I’m trying to expose a Map or a List in a BP and set values in Level, but when I relaod this level (after saving of course) values in Map of Level instances of my BP have changed or disappeared and List is empty.
Is there any kind of preconisation to use map and list in BP for level design ?
We need way more info on what you’re doing. You say you’re changing a Map or List in BP. Which BP are you changing? The main one in your asset browser or an instance in your level? Those are two different things. Also, what do you mean by reloading a level? Are you closing the editor and relaunching the editor? Otherwise, the level is still loaded even if you run it. Are you editing the Map while running the level? It’s not clear.
Then you say “level Instance”. Not sure if you actually mean a level instance or if you forgot a comma and meant that “when I reload this level values in Map in Level, instances of BP have changed”.
Are you changing this Map in the editor or at runtime?
I created a BP where among other variables, I created and exposed a Map variable (and then a List to try a different solution).
I dont initialise any value in this BP, but I’d like to set values in Levels on instances of this BP.
But when I reload the test level, values have disappeared from instances.
To be more precise, I created Map/List on a BP, then I created 2 other BP based each on the first one (inheritage) and then I instanciated each of the derived BP in Level, where I set differents values in Map and List.
Anything you set at runtime will be lost once you stop playing. If you want to keep those values around, you have to use serialization and reload them when you play the level again. They will never show up in the editor unless you do some more in-editor custom serialization.
Setting the values directly in your blueprint like in your last screenshot is the right way to do it. Note that you can set default values for your list or map. You don’t need to use a blueprint graph to set them. Also, there’s a MakeArray node that’s a bit cleaner if you do want to continue using your function.
Thank you for your answer. I was afraid this is the solution, but meanwhile I found how to force this values. I’d have apreciated that this kind of data structure are available at level design time, but I can do otherwise.