[Help] fixed it another way. Any ripples because of this?

Hi Guys!

I fixed the problem by resetting the static variable in lose collider script as follows:

void OnTriggerEnter2D (Collider2D collider){
	print ("trigger");
    //This is my fix:
	Brick.breakableCount = 0;
	levelManager.LoadLevel("Lose");
	
}

So far its working fine. What do you guys think?

1 Like

I also fixed it the same way, so far its working.

Cool idea! Seems to make sense.

I also fixed it this way, but after watching the video i decided to also add the code to the LevelManager.cs too, maybe the breakableCount carries over from one level to the next but i just have not tested to see if this is the case, so added the code as a safety measure.

I also fixed it that way. But then realised it could be problematic if you want to implement a concept where you have several attempts to go through a level and want to keep the brick count after loosing one attempt. Because every time it will be reseted to 0.