float oldWidth = 750f;
float oldHeight = 1334f;
float newWidth = Screen.width;
float newHeight = Screen.height;
float oldAspect = oldWidth / oldHeight;
float newAspect = newWidth / newHeight;
//水平方向缩放
float horizontalCompressionRatio = newAspect / oldAspect;
//垂直方向缩放
float verticalCompressionRatio = oldAspect / newAspect;
//0.462 0.562
FreezeEffecy.localScale = new Vector3(horizontalCompressionRatio, verticalCompressionRatio, 1);
750x1334 分辨率下为全屏显示,那么如何在相机size不改变的情况下使精灵全屏显示呢?相机是正交相机!需要计算不同分辨率下的比例,通过原始的比例和当前比例就能获的精灵的x 和 y的缩放比例,达到不同分辨率下不改变相机的size 使精灵显示的效果一样了