//If there is a score tracker, replace it with this one that is not deleted on scene change void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
// Start is called before the first frame update void Awake() { scoretext = FindObjectOfType <Text>(); tracker = FindObjectOfType <CreditTracker>(); scoretext.text = "Credits: " + tracker.GetCreditBalance().ToString("D6"); }