Accesing the score of a minigame (Scene2) to the MainGame(Scene1)

Thanks in advance mate, I am currently working on to add a mini game (Pick up money Game) to my Main Scene RPG Game.

In the mini game, player load another scene, and he will play a game picking money.

after the mini game end, I want to refer that money as an increase to player bag money in the Main Scene.

How can I do that??

Any Ideas/ help is very much appreciated Thanks.

There are many ways of doing this. Assuming you’re not uploading data anywhere and want it all local, you could use something as simple as PlayerPrefs, depending on what your build target is and how secure you need the data to be.

You could also use static variables to store the value, that way to can set and get it no matter what scene you are in.

There are other ways, but these two are fairly easy ways to do it.

1 Like

Thank you so much.
Yes I only require the data local, and that’s not going to need so much security as this is only an indie game
I guest I will try static variable first and then player pref, next

Thanks !

You can use DontDestroyOnLoad to allow a object to persist between scene loads and you can store data you need in all scenes on it.

1 Like

Many Thanks bro, that really helps,too!!