public void NextLevel() { if (levelObj == null) { return; } LevelContext curLevelContext = levelObj.GetComponent <LevelContext>(); LoadLevel(curLevelContext.nextLevel); if (curLevelContext.isCheckPoint) { savedLevel = curLevelContext.levelName; } PlayerPrefs.SetString(PrefsKey.SavedLevel, savedLevel); curLevelContext.TeleportPlayer(); }