1
I’m developing a game in Unity that consists of building a building made by blocks, and my game has an initial block and the rest of the blocks are all the same and they are generated through code when the game does a certain thing, in my Game Over script I have the blocks with the tag "block" and what I need to do is when one of these blocks falls to the ground the game ends, but it’s not happening someone knows how to solve ? Script Code "Gameover" :
public class GameOver : MonoBehaviour
{
// Start is called before the first frame update
public GameObject bloco;
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "bloco")
{
SceneManager.LoadScene(4);
}
}
}
Your script is associated with which object?
– lazyFox