GUISkin.window 窗口

var window : GUIStyle

Description描述

Style used by default for Window controls (SA GUI.Window).

用于Window控件的默认样式。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public GUIStyle style;
	public Rect windowRect = new Rect(20, 20, 120, 50);
	void OnGUI() {
		GUI.skin.window = style;
		windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "My Window");
	}
	void DoMyWindow(int windowID) {
		if (GUILayout.Button("Hello World"))
			print("Got a click");

	}
}
// Modifies only the window style of the current GUISkin
//修改当前GUISkin的窗口样式

var style : GUIStyle;
var windowRect : Rect = Rect (20, 20, 120, 50);

	function OnGUI() {
	GUI.skin.window = style;
	windowRect = GUILayout.Window (0, windowRect, DoMyWindow, "My Window");
}

// Make the contents of the window
//创建窗口的内容
function DoMyWindow (windowID : int) {
	// This button will size to fit the window
	//这个按钮的大小将适配窗口
	if (GUILayout.Button ("Hello World"))
		print ("Got a click");
}
最后修改:2011年1月25日 Tuesday 16:17

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。