private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { if (saveData != null) { health.SaveHealth(); ammo.SaveAmmo(); magic.SaveMagic(); shooting.SaveShooting(); saveLoad.lastScene = saveLoad.currScene; saveLoad.currScene = level; } Physics2D.IgnoreLayerCollision(10, 11, false); SceneManager.LoadScene(level); } }