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不可靠

版权声明:本文为yu__jiaoshou原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。