首页 > 编程语言 > 详细

Unity3D GUI学习之GUI窗口的使用

时间:2015-11-06 22:13:38      阅读:480      评论:0      收藏:0      [点我收藏+]

GUI还可以定义一个窗口,在窗口里面进行控件的添加:

using UnityEngine;
using System.Collections;

public class getbutton : MonoBehaviour {

    private Rect windowRect;
	void Start () {
        windowRect = new Rect(20, 20, 200, 200);
	}
	
	// Update is called once per frame
	void Update () {


	}

	void OnGUI()
    {

        windowRect = GUI.Window(0, windowRect, Mywindowfunc, "我窗口");
	}
    void Mywindowfunc(int windowId) { 
        if(GUI.Button(new Rect(10,20,100,20),"开始")){
            print("游戏开始........");
        }
        GUI.DragWindow(new Rect(0, 0, 10000, 1000));
    }

}

 效果如图;

技术分享

Unity3D GUI学习之GUI窗口的使用

原文:http://www.cnblogs.com/sunxun/p/4943703.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!