Created
September 20, 2018 06:07
-
-
Save nabesi777/7d3d513d050093ce7db1873b6e1dcc63 to your computer and use it in GitHub Desktop.
GUIWindow Unity&C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GUIWindow : MonoBehaviour { | |
//widowのスタート位置x,y、Windowのサイズx,y | |
private Rect windowRect = new Rect(500, 200, 200, 200); | |
void OnGUI() | |
{ //ID番号 ボックス 他のGUI(ラベル)をholdする? タイトル | |
windowRect = GUI.Window(0, windowRect, WindowFunction, "Windowタイトル"); | |
} | |
//windowIDを取得 | |
void WindowFunction(int windowID) | |
{ | |
//ラベルの位置x,y・入力可能サイズx,y 文字入力 | |
GUI.Label(new Rect(20, 20, 100, 50), | |
"文字入力文字入力文字入力文字入力文字入力文字入力文字入力文字入力文字入力文字入力"); | |
//ドラッグした時に反応する範囲、左上からx:100px・y:100pxが持てるよう指定 | |
GUI.DragWindow(new Rect(0, 0, 100, 100)); | |
} | |
// Use this for initialization | |
void Start () { | |
} | |
// Update is called once per frame | |
void Update () { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment