A custom GameInstance is the right way to go. Everything except your GameInstance will be wiped when opening a new level, so any variables you store in there should carry over. I suspect the issue has nothing to do with arrays but rather your implementation.
Start with a simple proof of concept to make sure everything is working.
- Create a new BluePrint that inherits from GameInstance, call it “MyGameInstance” or something.
- Create a variable in there, a String variable called “TestVar” for example. Leave the default value to be empty string.
- Create 2 maps.
- In the first map, go to the Level Blueprint and on the Event BeginPlay make a “Get Game Instance” node, cast it to your MyGameInstance, then from the instance draw out a node and call “Set TestVar”. Type in a string there, say “Hello World” or something.
- Do whatever it is you’re doing to Open Level your 2nd map. Either a key press or whatever it is that you’re using as your trigger.
- In your 2nd map, open the Level Blueprint and again on Event BeginPlay just draw out a node for Get Game Instance, cast it to your MyGameInstance, and then from the instance draw out a node to Get TestVar. Then connect that to a Print and see what it says.
- Run it. It should show some debug print text saying “Hello World”.
If that doesn’t work, it’s probably because you forgot to set your Instance class in your Project Settings. Go to Edit → Project Settings → Maps & Modes. The very bottom option lets you select your custom Game Instance blueprint.
Hope that helps.
O