In the video Breakable tag is checked in the “Block” script, my game can work when I make the same code in the video.
When I make the challenge, I check the tag in “Level” script, my code is
public void CountBlocks()
{
//breakableBlocks++;
if (tag == "Breakable")
{
breakableBlocks++;
}
}
In the Block my code is
void Start()
{
level = FindObjectOfType<Level>();
//if (tag == "Breakable")
//{
// level.CountBlocks();
//}
level.CountBlocks();
gameStatus = FindObjectOfType<GameSession>();
}
When I try this, the count is not work.
I don’t know what is wrong in the code, hope someone can help me.
Thanks.