Skip to content

Instantly share code, notes, and snippets.

@Stals
Created July 28, 2015 07:50
Show Gist options
  • Save Stals/7247367dfcf7fa0b4d20 to your computer and use it in GitHub Desktop.
Save Stals/7247367dfcf7fa0b4d20 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class Gismo16to9 : MonoBehaviour {
public void OnDrawGizmos()
{
var camSizeHeight = Camera.main.orthographicSize;
var camSizeWidth = camSizeHeight * 16f / 9f;
var leftUp = new Vector2(-camSizeWidth, camSizeHeight);
var leftDown = new Vector2(-camSizeWidth, -camSizeHeight);
var rightUp = new Vector2(camSizeWidth, camSizeHeight);
var rightDown = new Vector2(camSizeWidth, -camSizeHeight);
Gizmos.color = Color.white;
Gizmos.DrawLine(leftUp, leftDown);
Gizmos.DrawLine(leftDown, rightDown);
Gizmos.DrawLine(rightDown, rightUp);
Gizmos.DrawLine(rightUp, leftUp);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment