Same visible area regardless of aspect ratio
来源:互联网 发布:华为软件培训 编辑:程序博客网 时间:2024/06/07 06:14
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Test : MonoBehaviour { // Use this for initialization const float KEEP_ASPECT = 16 / 9f; void Start() { float aspectRatio = Screen.width / ((float)Screen.height); float percentage = 1 - (aspectRatio / KEEP_ASPECT); Camera cam = GetComponent<Camera>(); cam.rect = new Rect(0f, (percentage / 2), 1f, (1 - percentage)); } // Update is called once per frame void Update () {}}
参考:
http://answers.unity3d.com/questions/23291/same-visible-area-regardless-of-aspect-ratio.html
阅读全文
0 0
- Same visible area regardless of aspect ratio
- 什么是aspect ratio
- 什么是Aspect Ratio?
- Aspect Ratio转换
- Picture Aspect Ratio
- Sample Aspect Ratio
- Picture Aspect Ratio
- zoj 1439 Area Ratio
- zoj 1439 Area Ratio
- WOJ1286-Area Ratio
- Pixel Aspect Ratio from Wiki
- Update your app to take advantage of the larger aspect ratio on new Android flagship devices
- Retrieving MmPhysicalMemoryBlock regardless of the NT version.
- UGUI之Aspect Ratio Fitter组件介绍
- display aspect ratio和遥控器上的调整
- Layout Element Content Size Fitter Aspect Ratio Fitter
- ZOJ.1439 Area Ratio【三角形外接圆内切圆】 2015/10/20
- Is it possible to get the difference from two dynamic arrays regardless of their order?
- 虚拟机安装的系统界面很大的解决办法
- Android开发之---有关图片压缩
- CMD命令工具--Windows下使用tree命令生成目录
- 汽车品牌及产品信息汇总
- OKHttp学习步骤
- Same visible area regardless of aspect ratio
- webpack基础用法
- js实现-商城分类导航效果
- 没有异常的问题,从jar包入手
- 互联网+环球生意邦·百业创新商业模式生态峰会
- 结构体的定义和使用,以及typedef的使用。
- TortoiseSVN
- excel 下载模板
- 多个tomcat同时访问一个项目的配置