Skip to content

Instantly share code, notes, and snippets.

@mendesbarreto
Created December 2, 2014 18:57
Show Gist options
  • Select an option

  • Save mendesbarreto/a0800457defcce06bd53 to your computer and use it in GitHub Desktop.

Select an option

Save mendesbarreto/a0800457defcce06bd53 to your computer and use it in GitHub Desktop.
This helps calculate the orthographic camera size in the Unity3D
public class CameraSizeHandler : MonoBehaviour {
//public Camera cam;
// Use this for initialization
void Start ()
{
Resolution res = Screen.currentResolution;
Camera cam = this.gameObject.GetComponent<Camera>();
cam.orthographicSize = (res.height * 0.5f) * 0.01f;
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment