Moving past prototype: importing artwork (Game Dev day 14)
Let’s take one last look at our prototype before beginning the process of importing art assets.
Now let’s see what it looks like with a few simply art assets added in.
Fortunately, importing assets in Unity is extremely simple. Let’s start with setting up our background “Galaxy”.
To set this up, all we need to do is add a sprite renderer to our “Background” object in our hierarchy, then drag the asset we want into the Sprite renderer
Now, we need to attach the appropriate sprite to this.
We can move the sprite around in the scene window if it isn’t in the correct place, but that won’t be necessary here.
The last step is to set the layer that this art asset rests on. In 2D environments, all of the object are sitting on top of each other. We want to make sure that the Background is always at the very bottom of that pile.
We can make ourselves some sorting layers inside the Sprite Renderer.
Now we set the Background to the Background layer. The layer order goes from top to bottom, with the topmost layer being the LOWEST layer. In the above example, it means that the background will ALWAYS be lower than anything placed in the “Foreground” layer.
Now we can do the same process for our Enemy, our Laser, and our Player objects! Make sure they are all on the Foreground layer, or they might appear behind some of the background stars. Make sure you apply the sprite to the Prefabs, and not just one object in the scene window!