Collision requires a Rigidbody

Two non-physics object’s collision is not detected by Unity. You need to add a Rigidbody component to at least one gameobject

Null Reference

While copy pasting code you need to assign the public variables in the inspector. Or you will get a null reference error.

Wrong Usage of Unity Awake()


Unity Awake is Called even when the script is disabled but not called if the game object to which the script is attached is disabled.