using UnityEngine;
using System.Collections;
public class winTest : MonoBehaviour
{
// Use this for initialization
private Rect rect1 = new Rect(30,30,150,150);
private Rect rect2 = new Rect(30,200,150,150);
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
GUI.Window(1,rect2,onWindowTwo,"窗口2");
}
void onWindowOne(int winId)
{
GUI.Label (new Rect (10, 10, 140, 30), "当前窗口id是" + winId);
if (GUI.Button (new Rect (10, 30, 80, 30), "按钮1"))
{
Debug.Log ("当前窗口id"+winId);
}
}
void onWindowTwo(int winId)
{
GUI.Label (new Rect (10, 10, 140, 30), "当前窗口id是" + winId);
if (GUI.Button (new Rect (10, 30, 80, 30), "按钮2"))
{
Debug.Log ("当前窗口id"+winId);
}
}
}
using System.Collections;
public class winTest : MonoBehaviour
{
// Use this for initialization
private Rect rect1 = new Rect(30,30,150,150);
private Rect rect2 = new Rect(30,200,150,150);
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
//窗口id 窗口大小 窗口回调(定义窗口内视图) 窗口标题
GUI.Window (0, rect1, onWindowOne,"窗口1");GUI.Window(1,rect2,onWindowTwo,"窗口2");
}
void onWindowOne(int winId)
{
GUI.Label (new Rect (10, 10, 140, 30), "当前窗口id是" + winId);
if (GUI.Button (new Rect (10, 30, 80, 30), "按钮1"))
{
Debug.Log ("当前窗口id"+winId);
}
}
void onWindowTwo(int winId)
{
GUI.Label (new Rect (10, 10, 140, 30), "当前窗口id是" + winId);
if (GUI.Button (new Rect (10, 30, 80, 30), "按钮2"))
{
Debug.Log ("当前窗口id"+winId);
}
}
}