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");
}
Page last updated: 2011-1-25