using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FixedRatio : MonoBehaviour {

	// Use this for initialization
	void Start () {
		// Screen.SetResolution(720, 1280, true);
		return;

		// float targetaspect = 1280.0f / 800.0f;
		float targetaspect = 9f / 16f;
     
        float windowaspect = (float)Screen.width / (float)Screen.height;
     
        float scaleheight = windowaspect / targetaspect;
     
        // obtain camera component so we can modify its viewport
        Camera camera = GetComponent<Camera>();
     
        // if scaled height is less than current height, add letterbox
        if (scaleheight < 1.0f)
        {  
			Rect rect = camera.rect;
		
			rect.width = 1.0f;
			rect.height = scaleheight;
			rect.x = 0;
			rect.y = (1.0f - scaleheight) / 2.0f;
		
			camera.rect = rect;
		}
		else // add pillarbox
		{
			float scalewidth = 1.0f / scaleheight;
		
			Rect rect = camera.rect;
		
			rect.width = scalewidth;
			rect.height = 1.0f;
			rect.x = (1.0f - scalewidth) / 2.0f;
			rect.y = 0;
		
			camera.rect = rect;
		}
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
