void Start() { if (instance) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
public Slider slider; // Loading slider. void Start() { // Getting instance. If same exists, destroy it. if (instance) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }