//Makes sure that the instance is not null void Awake() { if (instance == null) { instance = this; } }
void Start() { if (Instance == null) { Instance = this; if(Advertisement.isSupported) Advertisement.Initialize("85995"); if (!PlayerPrefs.HasKey(AD_COUNT_KEY)) PlayerPrefs.SetInt(AD_COUNT_KEY, 0); } else if (this != Instance) Destroy(this.gameObject); PlayerPrefs.SetInt(AD_COUNT_KEY, 0); DontDestroyOnLoad(this.gameObject); }