2016-10-11 4 views

答えて

1

Screen.heightを使用して、画面の最大Y値を取得できます。あなたの場合、私はScreen.height - 100と言っています。ボタンの高さを引く必要があるからです。

X値は明らかにScreen.widthです。

0

これはスケーリングについての場合です。キャンバスを使用します。

しかし、あなたは(旧)GUIを使用する必要がある場合、行列を使用します。

 public void OnGUI(){ 
//First thing is the matrix 
      GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (Screen.width/1280, Screen.height/720, 1)); 

    //code 
     } 

http://answers.unity3d.com/questions/169056/bulletproof-way-to-do-resolution-independant-gui-s.html

https://docs.unity3d.com/ScriptReference/GUI-matrix.html

とあなたの質問の使用に答えるために:

Screen.widthを Screen.height

関連する問題