How I can count how many time gameOver scene is loaded ?

I’m building a game and I want to add an interstitial ads to it, but I want it to appear after the player lost every 3 times. So when the player loses for the first time the ads will appear, and when he loses for the second and third time, nothing appears until he lost for fourth time.

You could just make a static variable to keep track of how many times you’ve died.

using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    static int timesDied; // Information is kept between level loads

    void Start()
    {
        Die(); // "ADVERTISEMENT: sham poo"
        Die(); // "ad free death"
        Die(); // "ad free death"
        Die(); // "ADVERTISEMENT: sham poo"
    }

    public void Die()
    {
        if (timesDied++ % 3 == 0) // Left hand side will be 0, 1, 2, 0, 1, 2 etc
            DisplayAds();
        else
            print("ad free death");
    }

    void DisplayAds()
    {
        print("ADVERTISEMENT: sham poo");
    }
}