Now that our player can be killed, let’s start coding up some villainy to kill them. We’ll make a generic script called Hazard that makes a GameObject kill the player on touch. We’ll use this to create dangerous projectiles and an obstacle type that periodically fires them.
Collision Detection
Before we make a script that reacts to a touch, we’ll need to dive into collision detection to understand how Unity deals with such things. There are three major concepts that relate: colliders, Rigidbodies, and layers. ...