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:


A while ago, we added the use of thrusters to our player. Let’s add a visual cue as to the use of it. Since it is; a ‘visual’ cue; we are going to need to add images to our scene. For simplicity I have decided to use rectangles, one white that is just a little bigger than the other, blue.

Rectangles children of Canvas

Now we need to add a slider component to the white rectangle (possibly called Thruster_Bar_img). Then we need to drag the blue rectangle (possibly called (Thruster_Bar_Inner) into the Fill Rect field of the slider.


Before we can have the player fire a missile, we need a way to set our _closestEnemy variable to the closest enemy. Googling ‘nearest target unity’ and searching through gives us the following code to pilfer:

We can add this method to the MissileBehaviour script as well as adding the below to the Update() method:


First thing we need to do is create a missile object and then create and attach a script to it; let’s say MissileBehaviour. Adding the following method to this script:

We will also need to add a variable _missleSpeed and set it to say 5. Then adding the following to the Update() method of this script:


Since we have allowed the enemy to shoot and damage the player, maybe we should add a collectable that can heal. In order to accomplish this, we will need to add another case to our powerup script, such as:

Then we need to add this new method to our player script.


I guess since we limited the number of times our player can fire, we should add a collectable that will refill the ammo. In order to accomplish this, we will need to add another case to our powerup script, such as:

Then we need to add this new method to our player script.


First we will need to add a variable to our player script as below:

Then we will need to add the below to the playerMovement() method of our player script:


Since like our Speed power-up, we want our player to gain speed; this time, through the use of a key; we will need to create another variable. In our player script add a variable such as:

SerializeField so we can adjust in inspector.

To have our player move at 2.5 times normal speed; when we press the Left Shift key; we just need to add the following code to our player script in the playerMovement() method.


As I intimated in ‘How to Build and Test Our Unity Game’, if we want our game to run in Fullscreen we need to code a way to exit the game; since there is no built in functionality for that.

Therefore, if we type; application exit unity into Google; the first thing to come up for me is:

Clicking on this link will bring up:


The first thing we need to do, is left click on File, then left click on Build Settings, as shown below:

This will open up the following screen:

Jason Schneider

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store