4. Restart and continue playing

Restart the game and check that the same player’s coins and quest progress are restored.

Restart the game you built through chapter 3 to check that your coins and active quest are still there. In the Studio and SDK courses, this chapter needs no code or server-setting changes. In the Agent course, first give the request in “If you are following the Agent course” at the end of this page, have the agent build a way to switch to another player, and then do the checks below.

Check that your coins are saved

  1. Clear a quest and collect at least 10 coins. Once the reward appears, note the player ID and coin balance.
  2. Stop and restart Play Mode. Studio logs in automatically; with the SDK, click Log in. Use this login method each time you restart during this chapter.
  3. Compare the player ID and balance with the values you noted. They should match, with no quest in progress.

Coins and quest progress are stored in GS2. In chapter 1, you saved the credentials for the same account on the device. On restart, the game logs in with that account, and chapter 3’s display code fetches its data from GS2.

Resume a quest in progress

  1. Click Start for Forest exploration. When it appears as the active quest, stop Play Mode without completing it.
  2. Restart Play Mode and log in. Check that the same player ID and active quest appear.
  3. Click Complete. Once 10 coins are added and you can start another quest, note the balance.
  4. Stop Play Mode once more, then start and log in. The noted balance should appear, with no active quest.

Also try quitting and reopening a built app. Compare the player ID and balance before and after, as you did in Play Mode.

Compare with another account

  1. Note the original player ID and coin balance.
  2. In Studio, stop Play Mode, set PlayerPrefs Account Store’s Key Prefix to adventure.resume-test, and start again. With the SDK, stop Play Mode, set AdventureLogin’s Account Slot to resume-test, restart, and log in.
  3. If this storage slot has not been used before, you get a new player ID, zero coins, and no active quest.
  4. Stop Play Mode. In Studio, restore Key Prefix to adventure.main and restart. With the SDK, restore Account Slot to main, restart, and log in. Check that the original player ID and balance return.

If you are following the Agent course

In the Agent course, give the following request before you start the checks above. When the agent finishes, do the checks above in order. Log in the way the agent built it. In “Compare with another account”, switch players by changing the value that the agent’s report names.

In this folder, I am building a small adventure game with GS2 and Unity.
The GS2 project is adventure, the region is ap-northeast-1,
and I have already signed in.
This folder contains the GS2 Studio project Adventure
and the Unity project AdventureUnity.
So far, I have built login, the quest list (Forest exploration),
and starting and clearing quests with a coin reward (10 free coins per clear).

This time, I want to check that the same player can continue after closing the app.
- Explain where the coin balance and the quest in progress are saved,
  and how they come back when Play Mode is restarted.
- To check this, let me switch to another player to compare, then back to the original.
  I want to switch by changing just one value in the Unity Inspector.
  Do not delete the original player's data.
Keep everything built so far working.

When you are done, write the steps for me to check the result and a list of the numbers
you chose, without technical terms. If there is anything you did not try, list that too.

Check by asking the agent

  • “What data remains after the app is closed, and where is it? Tell me separately what stays on this computer and what stays in GS2.”
  • “What happens if the information on this computer is deleted?”
  • “What did you not try?”

If something goes wrong

  • Check Unity’s Console for red errors. If there are any, paste the message to the agent and ask it to fix the problem.
  • Stop Play Mode before you change the value that switches players. If you change it during Play Mode, the player may not switch.

Next: Spend stamina when starting a quest