- Home /
How to give star(reward) only during the first time the mission is completed?
I have got around 40 missions. Every time a player completes any mission one star is given as a result. The missions are replay-able i.e you can play them all over again. What I want is to be able to give the star only when the player completes the specific mission only the very first time. If the player completes the same mission again no star should be given then. How should I go about it? I am thinking PlayerPrefs. Storing whether the star for particular mission has been given or not.
Answer by LeeroyLin · Jun 21, 2018 at 07:34 AM
You can create a bool list or a Dictionary to store whether the missions have been completed. Then you can store this list in many ways, for example, PlayerPrefs. So when the player completes a mission and you should check if this mission has been completed by checking the list, if this mission has not been completed, give a star and record it.
Answer by tormentoarmagedoom · Jun 21, 2018 at 07:55 AM
Good day.
As LeeroyLin says, you only need to store the information in a array or list so you can chek if the level has been already completed. But you need to share this informations over all scenes, and over instances of the game (when the games is closed an open again)
PlayerPrefs are not think for this kind of issues, but it can work. The good solution is to save the data in a file and load this file when you open the game again.
You should watch the tutorial about DATA PERSISTANCE from Unity team. Is very clear and you will learn an important lesson if you want to develop games.
Bye!
Your answer
![](https://koobas.hobune.stream/wayback/20220612165156im_/https://answers.unity.com/themes/thub/images/avi.jpg)