Quality matters— From Prototype to Unity Assets!

3D to 2D

So far, I have been using 3d objects (cubes and capsules) and 3d components (Box Collider 3d and Rigidbody 3d). But, I will convert them into 2d with Sprite.

What is Sprite?

  • Sprite is a simple 2d object that is essentially a graphic image(texture). You can turn any png or jpeg image into Sprite, but usually, we would want to use png as png can have transparency — meaning we won’t see the square edges.
Difference between png (left) and jpeg (right) — image source: vectorstock.com

How to convert png image into sprite in Unity?

  1. drag and drop in the png file that you want to use into the Unity project folder window.
  2. Go to Inspector window → change the texture type from ‘Default’ to ‘Sprite(2D and UI)’
  3. Unity will ask you to confirm — click ‘Apply’.
  • You will also need to add Box Collider and Rigidbody to these gameobjects, HOWEVER, since we are converting from 3d to 2d, we need to make sure that we are adding Box Collider 2D and Rigidbody 2D.
  • In Enemy script, we will also need to convert OnTriggerEnter Method to 2D type as shown below.
Make sure that you are not missing anything such as variable value or tag from the previous gameobject.

Sprite Layers

In ‘order In layer’, the higher number is the closer is to the Top layer.
  1. To create a new sorting layer, you can click on ‘Default’ → Add sorting layer…
  • Please note that, in this ‘sorting layers’ window, the lowest row represents the highest sprite layer, so name them accordingly.
  • Player, Enemy, and laser = Foreground
  • Background sprite = background

--

--

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
Du Young Yoon

Du Young Yoon

XR Unity Developer / Designer / Architect