Adding a Camera Shake when Player is Damaged

Googling “camera shake unity” gives us the following code to pilfer:

Creating a script called CameraBehaviour, and adding it to our Main camera and then adding the above method to this script.

Adding the following variable to our Player script:

Then add the following to the Start Method of our Player script:

Then add the following to the Damage() method in our Player script:

And as long as the starting position of our camera is (0, 0) the result will be: