Unity Ads to display after a number of plays

in order to display ads after a number of plays what C# code should I write for unity ads? I would like for an ad to be displayed after every 7 plays. Thank you :slight_smile:

1- make an empty Game Object & attach this script to it :

   public class Data : MonoBehaviour{
   public static Data dat;
   public int counter = 0;
   void Awake () 
   {
	if (dat == null) 
	{
		DontDestroyOnLoad(gameObject);
		dat = this;
	}
	else if (dat != this)
	{
		Destroy(gameObject);
	}
 }
}

now from your script that include GameWin function :

void Start(){
 pnlWin.gameObject.SetActive (false);
 PnlPlaying.gameObject.SetActive(false);
}
void GameWin()
 {
     Data.dat.counter += 1;
     if(Data.dat.counter == 7){
     // play ad
     Data.dat.counter = 0 ;
     }
     else if(detect if win by your way){
     pnlWin.gameObject.SetActive (true);
     }
     else if(detect if lose by your way){
     PnlPlaying.gameObject.SetActive(true);
     }

 }