视频中数学关系似乎有问题,应为:
float aspect = Screen.width * 1.0f / Screen.height;
GetComponent<CanvasScaler>().matchWidthOrHeight = aspect >0.5625f ?1:0;
视频中数学关系似乎有问题,应为:
float aspect = Screen.width * 1.0f / Screen.height;
GetComponent<CanvasScaler>().matchWidthOrHeight = aspect >0.5625f ?1:0;