当前位置:网站首页>浅谈UGUI中Canvas RectTransform的Scale
浅谈UGUI中Canvas RectTransform的Scale
2022-06-11 20:08:00 【iningwei】
前言
Canvas的Rect Transform组件的Scale值和Canvas组件的Render Mode设置有关。
当为Screen Space - Overlay时Scale值为1,不可更改。
当为World Space的时候,Scale值默认为1,但是可以修改。
下面具体总结一下Render Mode为Screen Space - Camera时,Scale值的计算方式。
Screen Spcae - Camera模式下的Scale值
该模式下Scale值是由引擎内部自动计算得到的,且不能修改。
该模式依赖一个Camera,通常情况下在UI系统中我们会使用正交相机。下文详细探讨正交相机模式下的Scale值,透视相机后面有空再推导。
假设当前屏幕的高度为ScreenH,正交相机有个用户可以设置的参数Size,那么有公式如下:
ScreenH*Scale*(1/2)=Size
可以得到:Scale=(2*Size)/ScreenH
对比Sprite Renderer
在做纯2D游戏时,多使用Sprite Renderer组件,一般也使用正交相机,相机的Size设置规则为:Size=设计分辨率高度/100/2
建议
使用UGUI开发时,UI相机的Size不要随意设置。使用规则:Size=设计分辨率高度/100/2
边栏推荐
- Rule engine mode Net open source project case
- moderlarts第一次培訓
- 7905 和TL431 负电压稳压电路 - 相对于电源正极的稳压和浮地电路
- 2022-2028 global and Chinese thermopile array module market status and future development trend
- 2022-2028 global and Chinese thermopile detector Market Status and future development trend
- Leetcode 1992. Find all farm groups (yes, once)
- Proficient in xmake2
- In 2021, the global revenue of minoxidil will be about 1035million US dollars, and it is expected to reach 1372.6 million US dollars in 2028
- 周鸿祎:想做直播带货抹不下面子 数据勒索成突出的安全威胁
- 全名单!2022泰晤士亚洲大学排名公布!
猜你喜欢
随机推荐
Flutter doctor shows the solution that Xcode is not installed
计算926的9260次方里的字符串里有多少个926
Module 8 operation
The latest test questions and answers for the eight major members (standard members) of Ningxia architecture in 2022
Golang learning notes - Basics
Leetcode 1992. 找到所有的农场组(可以,一次过)
WR | 西湖大学鞠峰组微纳塑料污染对人工湿地菌群与脱氮功能的影响
Flutter doctor 顯示xcode沒有安裝的解决辦法
[Err] 1045 - Access denied for user ‘root‘@‘%‘ (using password: YES)
Jmeter安装
模块八作业
秀创意,赢显卡!MMPose姿态估计创意大赛震撼来袭
29. location对象
Proficient in xmake2
Off line operation of situation and policy (version) of Dayong in autumn 21 [standard answer]
Skywalking source code analysis Part 5 - server configuration configuration module startup
Questions and requirements of marketing course design in autumn 21 of Dagong [standard answer]
Major work title and requirements of engineering earthquake resistance in autumn 21 [standard answer]
Current situation and future development trend of tropical forage seed market in the world and China from 2022 to 2028
Explanation of LNMP architecture source code compilation and installation with pictures and texts (with forum experiment)








