Answer the question
In order to leave comments, you need to log in
How to implement this function in Unity2D?
In my project there is an in-game store for items that need to be bought for game currency, so here's how I make it (currency), how do I make it so that if I get the currency at the game level, it will be credited to the menu (item store located in the main menu / main menu and the game level are different scenes). And how to implement so that the game currency is saved when restarting?
If I didn't say something clearly. Ask.
Answer the question
In order to leave comments, you need to log in
document.querySelector('box4'); // ошибка. Точку перед box4 поставь
document.querySelector('.box4'); // вот так
You can’t do it yourself - use assets
https://assetstore.unity.com/packages/templates/sy...
- you can implement it through playerprefs,
- you can use static variables,
- you can do it normally and load part of the content only from the level (see dontdestroyonload )
- you can have an asset ready to use
the unity theme and it's beautiful that there are hundreds of millions of possibilities. You just need to figure out what is right for you and use it.
I would not recommend storing any money-related data locally. Only on your server with verification of all transactions. Otherwise, all your domestic currency will immediately wind up, do not hesitate.
In addition, the second question immediately disappears: you can download data on the amount of internal currency (and everything else) on any screen, when you need it.
Even if you have an offline game, it's best not to store locally.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question