Created
July 28, 2015 07:50
-
-
Save Stals/7247367dfcf7fa0b4d20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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