当前位置:网站首页>unity 屏幕自适应
unity 屏幕自适应
2022-04-23 06:27:00 【老少年】
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;
//实际正交视口 = 初始正交视口 * 初始宽高比 / 实际宽高比
GetComponent<Camera>().orthographicSize = (initOrthoSize * (initWidth / initHeight)) / (factWidth / factHeight);
}
}
核心公式:实际正交视口 = 初始正交视口 * 初始宽高比 / 实际宽高比
版权声明
本文为[老少年]所创,转载请带上原文链接,感谢
https://blog.csdn.net/laoshaonian/article/details/99719320
边栏推荐
猜你喜欢
SAP pi / PO rfc2soap publishes RFC interface as WS example
防抖和节流
Authorization+Token+JWT
SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)
int a = 1存放在哪
SAP PI/PO功能运行状态监控检查
‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件
ABAP 7.4 SQL Window Expression
SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)
Super classic & Programming Guide (red and blue book) - Reading Notes
随机推荐
js案例之求最大值,反转数组,冒泡排序
C# SmoothProgressBar自定义进度条控件
keytool: command not found
8. Paging query
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
Use of typescript dictionary
如何判断点是否在多边形内(包含复杂多边形或者多边形数量很多的情况)
手游性能优化
SAP pi / PO rfc2soap publishes RFC interface as WS example
'NPM' is not an internal or external command, nor is it a runnable program or batch file
ABAP 实现发布RESTful服务供外部调用示例
14. Transaction processing
int a = 1存放在哪
13. User and authority management
SAP TRANSLATE使用数据对象掩码示例
SAP ECC连接SAP PI系统配置
js之什么是事件?事件三要素以及操作元素
H5 local storage data sessionstorage, localstorage
刨根问底---cocos2d源码的理解与分析
SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)