I have a game where you jump from platform to platform avoiding enemies and avoiding red cubes.
I want to make it so if you hit the ground it will take you to a different scene (in my case it would be the “you died” screen)
here’s my code [note I started coding 2 days ago, it’s a C# script]
Did you add the “death” scene into the build settings? Open your death scene, go to file > Build settings > Add current, then you can switch scenes.
Another issue could be that OnCollisionEnter is not being called because the collision detection failed. You can put in a simple Debug.Log() call in your code and look in the console to see if it detects the collision:
If you see that the collision event is not firing, you need to verify that one of the game objects involved in the collision has a rigidbody (with Is Kinematic set to false), and that both game objects involved have a collider component, and that “isTrigger” is unchecked.