// Start is called before the first frame update void Start() { if (instance == null) { DontDestroyOnLoad(this.gameObject); instance = this; } else { Destroy(this.gameObject); } }
private void Awake() { if (instance == null) { DontDestroyOnLoad(this.gameObject); instance = this; } else { Destroy(this.gameObject); } characterBox = gameObject.GetComponent <BoxCollider2D>(); boundBox = GameObject.FindGameObjectWithTag("Background").GetComponent <BoxCollider2D>(); }