Basically, I am Making a brick breaker game and need the ball to break brick2 only if the ball has already broken brick 3. Once the ball has broken Brick 3 the texture turns blue. I have it so that if Texture == blue then do everything in this block. but for some reason when I run the program, that block never seems to execute. I have no Compilation errors. I think its a logic problem. Does anyone know a soloution to my problem? The program does not seem to understand if(Texture==blue) although it compiles it fine
var blue : Texture;
function OnCollisionEnter(col : Collision){
if(col.collider.name == "Brick3"){
Destroy(col.gameObject);
score += 10;
guiScore.text= "Score: " + score;
renderer.material.mainTexture = blue;
}
if(col.collider.name == "Brick2" && Texture == blue){
Destroy(col.gameObject);
score += 10;
guiScore.text= "Score: " + score;
print("collided with brick");
}
}