Objective: To give your game an ‘Escape’ button feature in Unity!

You have created your game, set up the build on your desktop to play in full windowed mode and now all of sudden you have no way of exiting out of the game! Like with everything else we have built in our game so far, we need to create the functionality of an ‘Escape’ button through code as it isn’t simply sitting there waiting for us to press it. Lucky for you this is one of the easiest features to create in a game, let’s get into it!

GameManager

This…


Objective: To get your game setup for a WebGL build in Unity!

Now that we have previously walked through getting your game built for Windows/Mac, it is time to take the next step and share it with the World! Maybe you might want your friends, family or work colleagues to give it a go in order to provide some valuable feedback to you to help polish the final product? or, it is that damn good that you just want people to play it as soon as possible! Either way, let’s get your Unity game on the web.

Build Settings

Firstly, similar to…


Objective: To get your game built and ready to be play tested in Unity!

This is relatively quite an easy process depending on how in depth you want to go with your build settings, but for the purpose of simply getting your game set up with the basic settings so you can have some fun with the game you have been creating for the last few weeks/months, let’s get into it!

Build Settings

To get started, head on up to File → Build Settings. …


Objective: To add some sounds effects to our players lasers and an exploding asteroid in Unity!

Tenor.com

Now that we have previously ran through the basics of sound by adding some background music to our scene and understanding that we require an Audio Listener to play music in a game, it is time to add some cool sound effects to our players lasers and an exploding asteroid.

Adding a Sound Effect to our Laser

To get started, let’s create an empty game object to our Audio Manager as a child and call it “Laser_Shot_Audio_Clip”. …


Objective: To introduce the next element into our Unity project — Sound!

Tenor.com

It is now time to get started with adding some cool sound effects to our game like the background music, lasers shooting and enemies exploding to take our game immersion to the next level. Let’s first get started with adding some background music to our scene.

Adding Background Music

Just like we have a Game Manager, Spawn Manager and UI Manager, it is time to create an Audio Manager that is going to handle the audio for our game. …


Objective: Taking our simple 2D Galaxy Shooter in Unity and adding a post processing effect to it to take it to the next level.

Now that we have setup post processing for our game, it is time to run through one of the effects that we have available to us to take our beautiful scene to the next level. Let’s get started with how to add an effect to your Post Process Volume game object. Make sure you have it selected in the Hierarchy, and then within the Inspector click ‘Add Effect’ under the Post Process Volume component. …


Objective: To get started with using Post Processing in in our 2D Galaxy Shooter game in Unity!

Firstly we need to make sure that we have the package downloaded into our project. To find this, we need to go up to the top tabs in Unity and click Window → Package Manager → Post Processing → Install.


Objective: To show how to setup a damage VFX for our players thrusters in our 2D Galaxy Shooter using animated sprites in Unity!

Let’s now add a thruster engine to our players space ship that is animated by sprites and also add a left and right engine so that when the player gets hit it will trigger one of these engines to be on fire and also play an animated sprite. To start let’s work on simply adding the main thruster that will always be on:

Main Engine Thruster

Let’s start by simply dragging the first sprite into the Hierarchy and making it…


Objective: The follow up article to creating an enemy explosion in Unity!

Following on from the last article it is time to look at the scripting side of triggering this animation to play. Let’s open up our ‘Enemy’ script, in the OnTriggerEnter2D() section and we are going to add some code that is going to set the OnEnemyDeath trigger from false to true. Currently at default it is sitting as false.

First, let’s create a handle to the Animator component and don’t forget to GetComponent the Animator.

Next, in the OnTriggerEnter2D() method where are enemy is colliding with the laser


Objective: To create an enemy explosion when they are destroyed!

Next up we are going to create an enemy explosion animation through sprites for when the enemy is destroyed by either getting hit by a laser or by running into the player.

Animation

First, let’s start with creating the animation sequence. To do this make sure to have the enemy prefab game object highlighted and then click on the ‘Animation’ tab. Click ‘Create’ and then name it ‘Enemy_Explosion_Anim’. From here, click on the record button and then drag in all the sprites in the sequence. …

Chris Hilton

Aspiring Unity Game Developer with a passion for bringing code to life!

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