// Start is called before the first frame update public void change_scene() { key_info = GameObject.FindGameObjectWithTag("key_info"); kis = key_info.GetComponent <key_info_script>(); kis.add_key(); SceneManager.LoadScene(5); }
// Start is called before the first frame update void Start() { rb = gameObject.GetComponent <Rigidbody2D>(); anim = gameObject.GetComponent <Animator>(); speed = 2; key_info = GameObject.FindGameObjectWithTag("key_info"); kis = key_info.GetComponent <key_info_script>(); }
// Start is called before the first frame update void Start() { if (instanceRef == null) { instanceRef = this; DontDestroyOnLoad(gameObject); } else { DestroyImmediate(gameObject); } }