トップ 一覧 検索 ヘルプ RSS ログイン

unity_ngui_get_root_sizeの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!!![NGUI] UI Rootの全体サイズを取得

UI Rootの全体サイズをスクリプトで取得します。

 float rootWidth  = 0.0f;
 float rootHeight = 0.0f;
 GameObject gameObject = GameObject.Find("UI Root") as GameObject;
   if (gameObject != null) {
     UIPanel panel = gameObject.GetComponent("UIPanel") as UIPanel;
       if (panel != null) {
          rootWidth  = panel.width;
          rootHeight = panel.height;
       }
    }
     if (panel != null) {
        rootWidth  = panel.width;
        rootHeight = panel.height;
     }
   }
 }
上記のrootWidth,rootHeightに全体の幅と高さが入ります。

----
{{lastmodified}}