Okay so, I have a button
public void ShowAd()
{
if (!UnityEngine.Advertisements.Advertisement.IsReady())
{
return;
}
if (m_LatestDisplayedAdTime == -1f
|| Time.time - m_LatestDisplayedAdTime >= m_IntervalBetweenAdsInSecondes)
{
UnityEngine.Advertisements.Advertisement.Show();
m_LatestDisplayedAdTime = Time.time;
PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins", 0) + 500);
}
and i have a timer for 300 seconds .
It works fine if i stay in the menu , but if i change scene and get back in the menu i can click it again, even if there is still plenty of time left … ?? how to keep the script working after scene load ?
Check out [DontDistroyOnLoad][1] [1]: https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
– KuR5Thanks Adam for the response, I work with Unity through macOS Sierra and haven't installed the antivirus, could it actually cause any issues?
– Tamererlan