Unity3D: From Prototype to Work of Art

Caleb Breuner
5 min readJul 28, 2021

How to switch from 3D blocks to sprites for a 2D game.

After having finished prototyping our game in 3D, we can begin transitioning our game into 2D. All of our 3D game objects will be replaced with sprites, which are simply 2D objects in the form of an image.

Sometimes, the easiest method is to create a new game object and move all the scripts associated from the previous game object to the new one.

While creating these new 2D game objects, we need to keep in mind that there are layers within a 2D game. We will be using background and foreground sorting layers to organize our game objects.

Backgrounds are easy. We will take our sprite for the background and drag it to the hierarchy.

We can adjust the background sprite to fit the window of the game.

We should also assign a sorting layer to this new background sprite so it does not overlay our players.

Next we can work on our player. We can simply create a new game object by dragging and dropping the sprite for our space ship into the hierarchy.

Once dragged, you want to update the tag for the Player from Untagged to Player. The original Player game object can be deleted.

Our space ship needs to be scaled down. This can be done by dragging the corners of our sprite or by changing its scale.

We will make a new sorting layer for the Player 2D game object. We will create the Foreground layer and assign it.

Next, we want to add three items to our new 2D Player game object.

  1. The Player Script
  2. 2D Box Collider
  3. 2D Rigid Body

First, we can simply drag and drop the Player script.

Second, we want to add a 2D Box Collider to the Player.

Make sure to select “Is Trigger.”

Third, we will add the 2D Rigidbody.

Make sure to change the gravity scale to 0.

For the laser, we can do the same as for the Player. We will drag and drop the laser sprite into the hierarchy.

We can scale it down to the proper size.

We need to make sure the laser is assigned to the Foreground layer like the Player.

We will add the same three items as we did for the Player.

  1. The laser Script
  2. 2D Box Collider
  3. 2D Rigid Body

First we add the script.

Second, we add the 2D Box Collider remembering to to select “Is Trigger.”

Third, we add a 2D Rigidbody and set the gravity scale to 0.

Just like for the Player, remember to select the “Laser” tag.

After having completed these, we can delete the previous laser prefab and replace it with our newly made 2D laser. We will delete from the hierarchy and add it to our Player game object.

For the Enemy prefab, we will not make an entire new game object. Instead, we will simply delete the meshes, previous rigid body, and box collider components. After doing so, we will drag and drop the enemy sprite into our Enemy prefab.

Note: When working with prefabs, make sure to open the prefab at the top of the inspector window.

Then we will add a sprite renderer with our enemy sprite imported.

Make sure to change the sorting layer for the Enemy’s sprite to the Foreground.

Then, we will add the 2D Box Collider and 2D Rigid Body.

We need to change the size of our 2D Box Collider so that it fits around the space of our enemy ship.

With our 2D Enemy setup within the inspector, we need to change the OnTrigger commands within our Enemy.cs script so that the collisions will occur in 2D.

OnTriggerEnter needs to be changed to OnTriggerEnter2D and Collider needs to change to Collider2D.

With our script and project saved, we may attempt to run our game.

--

--