首页 > 编程语言 > 详细

Unity3d GUI适应分辨率

时间:2019-04-15 21:20:09      阅读:136      评论:0      收藏:0      [点我收藏+]
float sourceWidth = 1024f;
    float sourceHeight = 768f;
    float m_fScaleWidth;
    float m_fScaleHeight;

    void OnGUI()
    {
        m_fScaleWidth = Screen.width / sourceWidth;
        m_fScaleHeight = Screen.height / sourceHeight;
        GUI.matrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity,new Vector3(m_fScaleWidth, m_fScaleHeight, 1));

        GUI.Button(new Rect(0, 0, 1024, 768), "");
    }

Unity3d GUI适应分辨率

原文:https://www.cnblogs.com/ldxsuanfa/p/10713104.html

(0)
(0)
   
举报
评论 一句话评论(0
分享档案
最新文章
教程昨日排行
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!