- 最后登录
- 2021-9-15
- 注册时间
- 2011-7-15
- 阅读权限
- 100
- 积分
- 50625
  
- 纳金币
- 53202
- 精华
- 32
|
using UnityEngine;
using System.Collections;
public class UIRootExtend : MonoBehaviour {
public int manualWidth = 640;
private UIRoot _UIRoot;
void Awake()
{
_UIRoot = this.GetComponent<UIRoot>();
}
void Start ()
{
if(Screen.width < Screen.height)
_UIRoot.manualHeight = System.Convert.ToInt32( System.Convert.ToSingle( Screen.height) / System.Convert.ToSingle( Screen.width) * System.Convert.ToSingle( manualWidth) );
}
}
只需要把这个插件Add到UIRoot就可以了
当屏幕宽度小于屏幕高度的时候,根据manualWidth调整UIRoot的manualHeight
原作者:vinson 转载于unity3d圣典 |
|