What's the best way to pass data between collections?

Hi, I’ve got 2 collections. When you collect a power up in collection ‘A’ a mini-game is loaded i.e. collection ‘B’. I want the score displaying in the HUD in ‘B’ to be the same as it was in ‘A’. The problem I’m having I think is that all of collection ‘A’ is wiped out before collection ‘B’ is loaded, so I can’t pass the score from ‘A’ to ‘B’ I get an error saying “Could not send message…” when I try. Is making a module the best way, or is there some other option that’s better? Cheers

Use Lua modules, and enable shared script memory in game.project file. Then you store the important information there. You can also have a main collection which is always loaded and manages persistent memory between screen/level collections.

3 Likes

If you use Monarch, you could pass data with the show() function to your new screen.

1 Like