When i run the code it reach it limit, it show the ad but after that it show ads after every restart of the scene.
{
int counter = 4 ;
public int Counter
{
get
{
return counter;
}
set
{
counter = value;
}
}
void Awake()
{
if (Counter>2)
DontDestroyOnLoad(this);
}
void OnLevelWasLoaded(int level)
{
if (level == 1)
{
if (Counter == 2)
{
Counter = 5;
Advertisement.Show();
}
else
{
Counter--;
}
Debug.Log(Counter);
}
}
↧