Prototype to Work of Art

Once we have the basic concepts of our game in place and functioning, we can look at moving away from the Unity primitives and getting some assets into our game.

I’ll be using assets from the awesome Filebase that you can find here.

Firstly, with the project I’ve been building over the previous articles intended to be a 2D shooter, we first need to switch from 3D design mode to 2D design mode.

From there, we can change from the default Unity skybox to a solid color background and bring in a backdrop for our game — ensure that the image you want to use is set as a ‘Sprite (2D and UI)’ texture type and re-size to the screen size.

Now would also be a great time to move from the rather ambiguous ‘Free Aspect’ ratio to the more widely used 16:9.

From here it’s a case of swapping out all of our 3D components for our 2D assets, there are a couple of ways to achieve this. We could edit our current objects by removing the 3D variants of components and replacing with 2D ones —

Swapping our 3D Laser prefab components for 2D

Alternatively, we could create a new object from scratch and transfer our script information over to the new GameObject —

Creating a new 2D Player GameObject

Use either method for converting your Enemy to 2D and then be sure to resize the colliders for all of your new 2D GameObjects —

Resizing the Player’s 2D Box Collider

The last step we need to take is to bring our code up to date with our changes as we are currently looking for 3D collisions between our now 2D GameObjects —

Converting 3D Trigger detection to 2D

With all that complete, let’s test our game again!

From Prototype to Work of Art

What a massive difference that makes to the look of our game!!

NOTE: If you have an issue where sprites appear behind the background, take a look at the Sprite Renderer on your objects and change the ‘Order in Layer’ option — the lower the number, the further back the Sprite will be rendered.

For more advanced flexibility, you can assign different ‘Sorting Layers’ to enable further separation when rendering different objects in your scene.

A UK based Unity Developer with a passion for gaming and coding