In the previous lectures we used a variable breakingblocks(or something like that) in a function called CountBlock()
and called it in the Start(). When our script executed every breakable block called this function and thus we got our no. of breakable block.
In this lecture we used a variable timesHit
and we increased its value when ball collides with block and it dosen’t destroy. However every block consist this same variable in the same script and just like breakingblocks
, if the ball collides with any block in my scene then timesHit
should increase by one. But this is not the case and timesHit
is working like an individual variable for all types of block…WHY???..
Also one more thing…
What’s the difference in using if( tag == "Something")
and if(CompareTag("Something"))