码迷,mamicode.com
首页 > 其他好文 > 详细

ScriptableWizard 脚本化向导

时间:2015-10-23 16:25:08      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:

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;
}
}

 

技术分享

ScriptableWizard 脚本化向导

标签:

原文地址:http://www.cnblogs.com/lijian-boke/p/4904720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!