ScriptableWizard.OnWizardCreate 当向导创建

function OnWizardCreate () : void

Description描述

This is called when the user clicks on the Create button.

当用户在创建按钮上点击是调用。

Here you perform any final creation/modification actions. After OnCreateWizard is called, the wizard is automatically closed.

在这里执行任何最终创建/修改动作。OnCreateWizard调用之后,向导自动关闭。

参见:ScriptableWizard.DisplayWizard

ScriptableWizard.OnWizardCreate 当向导创建

Scriptable Wizard window for selecting GameObjects of a certain "type".
脚本化向导窗口用于选择有一定的“类型”游戏物体。

// C#
// Editor Script that lets you "Select" all the GameObjects that have a certain Component.
//编辑器脚本让你"Select"所有带有一定组件的游戏物体,
using UnityEngine;
using UnityEditor;
using System.Collections;

public class ScriptableWizardOnWizardCreate : ScriptableWizard {
	public string componentName = "Camera";

	[MenuItem ("Example/OnWizardCreate example")]
	public static void SelectAllOfTypeMenuIem() {
		ScriptableWizard.DisplayWizard(
			"Select objects of type ...",
			typeof(ScriptableWizardOnWizardCreate),
			"Select");
	}

	void OnWizardCreate() {
		Object[] objs = FindObjectsOfType(typeof(GameObject));
		ArrayList selectionBuilder = new ArrayList();
		foreach (GameObject go in objs) {
			if(go.GetComponent(componentName))
				selectionBuilder.Add(go);
		}
		Selection.objects = selectionBuilder.ToArray(typeof(GameObject)) as GameObject[];
	}
}
Page last updated: 2011-6-25