Version : Unity 5.5
I have tried every possible thing but its just not happening. All my scenes are there in the build settings and in the last 2 days i tried almost every possible combination. Nothing is working. I changed the “Application.LoadedLevel” as well to something else before getting it back again because nothing seems to work. The count is correct, i just did a debug and thats working fine. Its resetting to 0. but its not going to Level 2. Its either Win OR Lose. Please help me.
Here are the screenshots of my scripts which have something to do with this behavior :
I actually did not solve it. i edited the win condition but now i realized that though it will go to the next level, after all the levels are over, it will not come out off it and go to the win screen. Please Help.
Thanks for the screenshot of the build settings, I wanted to check that the win scene wasn’t in the wrong order.
Looking at your LevelManager code however…
If you look at the BrickDestroyed() method you’ll note how, if all of the bricks have been destroyed, you load the “win” scene.
This method is called from your HandleHits() method in the Brick class.
What is happening is that your first level is played, all the bricks are destroyed, thus the condition is true and you load the win scene.
What you want instead is this;
/// <summary>
/// Determines whether the next level should be loaded
/// </summary>
public void BrickDestroyed()
{
if (Brick.breakableCount <= 0)
{
LoadNextLevel();
}
}
This will then increment the build index by 1 and load the next playable level if there are any more to play, if not, you will be taken the win scene.
Hope this helps.
p.s.
For the code formatting it is three of these characters ` not three of these .