0

How do i keep track of the amount of ads the player has watched, then reward the player when he has watched a certain amount of ads , e.g. 3 ads watched rewards the player the unlock of all levels or a certain amount of coins.

public Button[] lvlButtons;

    void Start()
    {
        int levelAt = PlayerPrefs.GetInt("levelAt", 2);

        for (int i = 0; i < lvlButtons.Length; i++)
        {
            if (i + 2 > levelAt)
                lvlButtons[i].interactable = false;
        }
        
    }

This is my Code that locks levels.

iSTAR
  • 11
  • 3

1 Answers1

0

There are different ways to approach this. The most simple is to save with PlayerPrefs the amount of successfull watched ads and just increment the number, and after you reward the player you can simply set the amount back to 0 in order to reset the counting.

Pavlos Mavris
  • 331
  • 1
  • 2
  • 12