首页 > 编程知识 正文

Unity 3D IOS设置分辨率问题汇总,设置分辨shi是问题是什么

时间:2023-05-05 16:35:19 阅读:261310 作者:594

Unity 3D - IOS设置分辨率问题汇总 : Screen.SetResolution一定要int值,在lua上设置要注意。

在lua上调用Screen.SetResolution传入的number型如果带有小数点,在IOS上会出现 分辨率错乱 问题,环境:(Unity版本2018.3.10f1)。


lua代码 :

--设置分辨率function GameSettingManager:SetResolutionLevel(resolutionLevel) --没有读取到设备宽高 (分辨率) if not DeviceWidth or not DeviceHigh then Logger.Log("不存在设备分辨率") return end local width = DeviceWidth local height = DeviceHigh if ResolutionType.Low == resolutionLevel then local lowRate = 0.5 width = width * lowRate height = height * lowRate elseif ResolutionType.Mid == resolutionLevel then local midRate = 0.8 width = width * midRate height = height * midRate elseif ResolutionType.High == resolutionLevel then --保持原分辨率 end width = math.floor(width) height = math.floor(height) Logger.Log("width : " .. width) Logger.Log("height : " .. height) CS.UnityEngine.Screen.SetResolution(width, height, true)end Screen.resolutions不可靠

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。