Hi. I want to create a winning condition. Destroying all the Bricks, then display a button of replay or next. But I don't know how to check if the Brick is completely destroyed in the scene.
function OnMouseDown (){
Application.LoadLevel (0);
}
function Start (){
Screen.showCursor = false;
this.gameObject.active = false;
}
function Update (){
if (gameObject.Find ("Brick(Clone)") ==0){
Screen.showCursor = true;
this.gameObject.active = true;
}
}
also GameObject.Find() != null on the if statement works
– ponchoYes. I read from Scripting Reference about using GameObject.Find in Update can cause slow performance. So what kind of code should I use?
– anon7480804As I mentioned, you should call the code every time a brick destroys.
– AliAzin