NGUI自适应屏幕
2014-08-14 12:17
211 查看
主要是改变Manual Height
制作UI时按640*960标准
一般在Awake()中调用
static private void AdaptiveUI()
{
int ManualWidth = 960;
int ManualHeight = 640;
UIRoot uiRoot = GameObject.FindObjectOfType<UIRoot>();
if (uiRoot != null)
{
if (System.Convert.ToSingle(Screen.height) / Screen.width > System.Convert.ToSingle(ManualHeight) / ManualWidth)
uiRoot.manualHeight = Mathf.RoundToInt(System.Convert.ToSingle(ManualWidth) / Screen.width * Screen.height);
else
uiRoot.manualHeight = ManualHeight;
}
}
制作UI时按640*960标准
一般在Awake()中调用
static private void AdaptiveUI()
{
int ManualWidth = 960;
int ManualHeight = 640;
UIRoot uiRoot = GameObject.FindObjectOfType<UIRoot>();
if (uiRoot != null)
{
if (System.Convert.ToSingle(Screen.height) / Screen.width > System.Convert.ToSingle(ManualHeight) / ManualWidth)
uiRoot.manualHeight = Mathf.RoundToInt(System.Convert.ToSingle(ManualWidth) / Screen.width * Screen.height);
else
uiRoot.manualHeight = ManualHeight;
}
}
相关文章推荐
- untiy使用ngui插件屏幕自适应问题解决方案
- 【Unity3D】【NGUI】屏幕自适应
- ngui 3.02老版本的屏幕自适应
- unityios开发--NGUI屏幕自适应
- nguI 屏幕自适应
- ngui屏幕自适应(三合一)
- 【Unity3D插件】NGUI屏幕自适应
- 【NGUI】屏幕自适应(不用UIStretch,用UIRoot)---------------good
- Unity3D NGUI屏幕自适应
- 【Unity3D插件】NGUI屏幕自适应
- NGUI之UIRoot屏幕分辨率自适应
- NGUI之UIRoot屏幕分辨率自适应
- NGUI UIRoot的屏幕自适应
- 【Unity3D插件】NGUI屏幕自适应
- 【Unity3D插件】NGUI屏幕自适应
- Unity3D NGUI 自适应屏幕
- NGUI屏幕自适应
- unity3d学习笔记(十四)--NGUI用Sprite动画和屏幕自适应制作游戏开始场景
- 【Unity3D插件】NGUI屏幕自适应
- Unity3D NGUI 自适应屏幕