Unity 2d Camera Aspector by codesbiome - 1

CameraGames & Projects

Adjust unity game 2D screen resolution / aspect-ratio automatically using this script component on Main Camera.

Unknown VersionUnknown LicenseUpdated 71 days agoCreated on June 25th, 2020
Go to source

2D Camera Aspector for Unity Engine

Script allows automatically adjust Aspect Ratio of Orthograhpic Main Camera used in Unity Engine 2D games.>


This script component comes with some default Inspector fields to manage:

  • Camera Axis Point
  • Room / Game-Level Width
  • Room / Game-Level Height
  • Camera’s Default Z Position
  • Pixel Per Unit used for Sprites in game

How to use

Copy the CameraAspector.cs file into unity project’s asset folder and Drag & Drop the script onto Main Camera object inside Hierarchy tab.

Or you can manually add Script Component for Main Camera, just make sure to select Main Camera in Hierarchy Tab, it will show details of Camera inside Inspector Tab, then press   Add Component > Script > Camera Aspector


Script used with various Aspect Ratios of Screen

Game with 1024 x 576 resolution (16:9) tested on various screen sizes. Some sprites are placed onto GameScene’s corners & center for checking the placement of objects during aspect ratios changes.


Aspect Ratio 16:9

(It matches with room width/height, so no letterbox)


Aspect Ratio 3:2

Black LetterBox bars will appear to adjust the Aspect Ratio

Aspect Ratio 4:3


Show all projects by codesbiome