after the level finishes the win screen is shown. which has two buttons continue and menu.i have managed to deactivate the buttons and only keep the 1st level button unlocked but cant get level 2 button to unlock when i clear level 1. also i want the continue button to jump to level 2 after it is shown in the next scene when completing level 1. this game is breakout style one and these are the problems that i am not able to solve. i have attached the respective scripts that i thought were necessary. if u want the others plz ask for them in the comments.a complete list of all scripts is at the end.i would really appreciate some help.i will definitely try to explain my problem a little more if u ask for them . so plz do check this question again later to checkout the changes.
the script below is attached to the level 1:-
{
[SerializeField] int breakableBlocks; // Serialized for debugging purposes
SceneLoader sceneloader;
private void Start()
{
sceneloader = FindObjectOfType<SceneLoader>();
}
public void CountBreakableBlocks()
{
breakableBlocks++;
}
public void BlockDestroyed()
{
breakableBlocks--;
if (breakableBlocks <= 0)
{
GetComponent<LevelSelector>().levelunlocked =
sceneloader.LoadWinScreen();
}
}
}
The script below is attached to level selector:-
{
public Button[] levelButtons;
public int levelunlocked = 1;
private void Start()
{
int levelReached = PlayerPrefs.GetInt("levelReached", levelunlocked);
for (int i = 0; i < levelButtons.Length; i++)
{
if (i + 1 > levelReached)
{
levelButtons[i].interactable = false;
}
}
}
}
Scene loader script:-
public class SceneLoader : MonoBehaviour {
public void LoadNextScene()
{
int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(currentSceneIndex + 1);
}
public void LoadStartScene()
{
SceneManager.LoadScene(0);
}
public void LoadLevelSelectScreen()
{
SceneManager.LoadScene(1);
}
public void LoadWinScreen()
{
SceneManager.LoadScene(5);
}
public void LoadGameOverScreen()
{
SceneManager.LoadScene(6);
}
public void QuitGame()
{
Application.Quit();
}
public void Level1()
{
SceneManager.LoadScene(2);
}
public void Leve2()
{
SceneManager.LoadScene(3);
}
}
this is the build setting:-
The Scripts that i have :- 1.Ball 2.Block 3.Level 4.LevelSelector 5.LoseCollider 6.Paddle 7.SceneLoader