纳金网
标题:
点击立方体弹出GUI窗口的代码
[打印本页]
作者:
王者再临
时间:
2014-12-31 22:11
标题:
点击立方体弹出GUI窗口的代码
给立方体挂上下面javascript代码,运行即看到效果
#pragma strict
static var WindowSwitch : boolean = false;
var mySkin : GUISkin;
var windowRect = Rect (200, 80, 240, 100);
function OnGUI ()
{
if(WindowSwitch == true)
{
GUI.skin = mySkin;
windowRect = GUI.Window (0, windowRect, WindowContain, “打开视窗”);
}
}
function WindowContain (windowID : int)
{
if (GUI.Button (Rect (70,40,100,20), “关闭视窗”))
{
WindowSwitch = false;
}
}
function OnMouseEnter ()
{
renderer.material.color = Color.red;
}
function OnMouseDown ()
{
WindowSwitch = true;
}
function OnMouseExit ()
{
renderer.material.color = Color.white;
}
复制代码
欢迎光临 纳金网 (http://wwww.narkii.com/club/)
Powered by Discuz! X2.5