2D Development in Unity

Table of Contents

Pixel Perfect discussion

So on a screen height of 1080 with orthographic size of 5, each world space unit will take up 108 pixels (1080 / (5*2)). It's 5 * 2 because orthographic size specifies the size going from the center of the screen to the top.

Therefore if your Sprite’s Pixels Per Unit (PPU) settings is 108, it will be rendered nicely.

Orthographic size = ((Vert Resolution)/(PPUScale * PPU)) * 0.5

Physics 2D reference

Sprites reference


Use Transform.up in 2D as forward howto

In 2D, you want to do your rotation in the Z-axis, and instead of .forward use .up or .right

Collider 2D reference

void OnTriggerEnter2D(Collider2D other) {
          if (other.CompareTag ("Bullet")) {
        Destroy (other.gameObject);