标签:
using UnityEditor;
using UnityEngine;
class WizardCreateLight : ScriptableWizard {
public float range = 500;
public Color color = Color.red;
public LightType enumPopup1;
public RectTransform rect;
[MenuItem ("GameObject/Create Light Wizard")]
static void CreateWizard () {
ScriptableWizard.DisplayWizard<WizardCreateLight>("Create Light", "Create", "Apply");
//If you don‘t want to use the secondary button simply leave it out:
//如果你不想使用辅助按钮可以忽略它:
ScriptableWizard.DisplayWizard<WizardCreateLight>("Create Light", "Create");
}
void OnWizardCreate () {
GameObject go = new GameObject ("New Light");
go.AddComponent("Light");
go.light.range = range;
go.light.color = color;
}
void OnWizardUpdate () {
errorString = "Please set the color of the light!";
}
// When the user pressed the "Apply" button OnWizardOtherButton is called.
//当用户按下"Apply"按钮,OnWizardOtherButton被调用
void OnWizardOtherButton () {
if (Selection.activeTransform == null ||
Selection.activeTransform.light == null) return;
Selection.activeTransform.light.color = Color.red;
}
}
标签:
原文地址:http://www.cnblogs.com/lijian-boke/p/4904720.html