private void Awake() { if (BgInstance != null && BgInstance != this) { Destroy(this.gameObject); return; } BgInstance = this; DontDestroyOnLoad(this); }
// Use this for initialization void Start() { bgScript = FindObjectOfType <BgScript>(); thisImage = GetComponent <Image>(); }
void Start() { s_instance = this; }