void SwitchLevel(bool right) { canClick = false; //Change the levelIndex if (right) { currentLevelUI.CtoL(); if (currentLevelUI == levelsUI[0]) { levelsUI[1].RtoC(); } else { levelsUI[0].RtoC(); } levelIndex++; } else { print("Going left"); currentLevelUI.CtoR(); if (currentLevelUI == levelsUI[0]) { levelsUI[1].LtoC(); } else { levelsUI[0].LtoC(); } levelIndex--; } //Change the level data target currentLevel = SaveManager.instance.currentSave.levels[levelIndex]; //Change the levelUI target if (currentLevelUI == levelsUI[0]) { currentLevelUI = levelsUI[1]; } else { currentLevelUI = levelsUI[0]; } SetUpLevelUI(); }