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