Transforming the Void: Adding a Stellar Space Background to Our Unity 2D Space Shooter

Chris Patino
3 min readMay 2, 2023

--

In the past couple of weeks, I’ve been grinding away at developing my first Unity game, working hard to get the logic and behavior just right. And after all that effort, I’m proud to say that I’ve created a functioning prototype that I’m really excited about. But we’re not stopping there! In the next couple of articles, I’ll be sharing with you the journey from “zero to hero” as we transform our game from a basic prototype to a stunning work of art.

Get ready to be amazed!

After obtaining all the necessary Materials, Sprites, and audio from Filebase, we are now ready to create the ultimate 2D space shooter game. But before we can begin, we need to switch our view from 3D to 2D to fully utilize the assets we have downloaded.

You should now be seeing your player from a perspective view.

Now that we are in 2D, let’s set up our background. Since we have already installed our assets from Filebase, we can easily locate the background file we want to use in our Sprites folder and drag it into the hierarchy. It should automatically attach to our game. Once attached, we can change its name to “background."

When dealing with Sprite Renderers, it’s important to keep in mind the concept of “order in layer” or sorting layers. The higher the number assigned to a layer, the closer it will appear to the viewer in the game.

When dealing with Sprite Renderers, it’s essential to keep an eye on the “order in layer” or sorting layers. The layer with a higher number will appear closer to the viewer in the game view. Therefore, to ensure that the player sprite is always in front of the background layer, set the background layer number to 0 and the player layer to 1, giving it a higher layer number.

Now, when you play your game, you’ll have a breathtaking outer space background to navigate through.

Alright, time to take our game’s aesthetics to the next level! We’ve already set up our background, so now it’s time to give our player and enemies some personality with some awesome graphics and sprites. Stick around for the next article to see how it’s done!

If you want to keep up with the progress I’m making on this game, be sure to follow me on Medium.

Keep In Mind 💡

Your background has transform options that you can use to stretch out your background sprite in order to fit the dimensions you need.

--

--