当前位置:网站首页>Unity screen adaptation
Unity screen adaptation
2022-04-23 07:47:00 【youth who behaves like an adult】
sing UnityEngine;
public class CamearAdaptation : MonoBehaviour
{
public float initOrthoSize;
public float initWidth;
public float initHeight;
float factWidth;
float factHeight;
void Start ()
{
factWidth = Screen.width;
factHeight = Screen.height;
// Actual orthographic viewport = Initial orthographic viewport * Initial aspect ratio / Actual aspect ratio
GetComponent<Camera>().orthographicSize = (initOrthoSize * (initWidth / initHeight)) / (factWidth / factHeight);
}
}
The core formula : Actual orthographic viewport = Initial orthographic viewport * Initial aspect ratio / Actual aspect ratio
版权声明
本文为[youth who behaves like an adult]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230626191292.html
边栏推荐
- SAP ECC连接SAP PI系统配置
- js之节点操作,为什么要学习节点操作
- SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
- Reflect on the limitations of event bus and the design and implementation of communication mechanism in component development process
- 事件系统(二)多播事件
- Hot change scheme and dynamic update strategy of mobile game
- url转成对象
- SAP PI/PO rfc2Soap 发布rfc接口为ws示例
- 保研准备经验贴——18届(2021年)中南计科推免到浙大工院
- unity UGUI判断点击在UI上和3D物体上的解决方案
猜你喜欢

canvas学习第一篇

SAP TRANSLATE使用数据对象掩码示例

H5 local storage data sessionstorage, localstorage

Date object (JS built-in object)

基于NLP的软件安全研究(二)

MySQL index

设置了body的最大宽度,但是为什么body的背景颜色还铺满整个页面?

FSM finite state machine

Ogldev reading notes

SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
随机推荐
踩坑日记:Unable to process Jar entry [module-info.class]
将指定路径下的所有SVG文件导出成PNG等格式的图片(缩略图或原图大小)
js之节点操作,为什么要学习节点操作
8. Paging query
13. User and authority management
What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
Online Safe Trajectory Generation For Quadrotors Using Fast Marching Method and Bernstein Basis Poly
SAP ECC连接SAP PI系统配置
利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)
'NPM' is not an internal or external command, nor is it a runnable program or batch file
Implementation of MySQL persistence
2. Restricted query
C#操作注册表全攻略
Thorough inquiry -- understanding and analysis of cocos2d source code
SAP CR传输请求顺序、依赖检查
Dropping Pixels for Adversarial Robustness
系统与软件安全研究(四)
promise all的实现
Super classic & Programming Guide (red and blue book) - Reading Notes
SQL针对字符串型数字进行排序