unity 中Canvas MatchHeight


设置了

UI Scale Mode = Scale With Screen Size,

Reference Resolution = X 1334, Y 750,

Screen Match Mode = Match Width Or Height,

Match = Width 0, Height 1,

 

---------------------------------------

获取屏幕实际宽度.(RectTransform 在Canvas中填满时的宽度)

 

1         this.RealHeight = 750f;
2         this.RealWidth = this.RealHeight / (float)Screen.height * (float)Screen.width;
3         UnityEngine.Debug.LogFormat("real: width:{0}  height:{1}", this.RealWidth, this.RealHeight);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM