Unity 编辑器扩展(八)ScriptableWizard

向导式的编辑窗口

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class TestScriptableWizard : ScriptableWizard
{
    public string s = "aaa";
    public int i = 500;
    public Color color = Color.red;

    [MenuItem("TestMenu/MyScriptableWizard")]  
    //弹出窗口调用
    static void CreateWizard()
    {
        ScriptableWizard.DisplayWizard("MyTestMenu", "确定", "应用");
        Debug.Log("CreateWizard");
    }
    //开启窗口或数据更新时调用
    void OnWizardUpdate()
    {
        helpString = "帮助或说明……";
        Debug.Log("OnWizardUpdate");
    }
    //当用户按下"应用"时被调用,保存设置但不关闭窗口
    void OnWizardOtherButton()
    {
        Debug.Log("OnWizardOtherButton");
    }
    //点击"确定"时调用,关闭窗口并保存设置
    void OnWizardCreate()
    {
        Debug.Log("OnWizardCreate");
    }
}

 

Unity 编辑器扩展(八)ScriptableWizard_第1张图片

 

你可能感兴趣的:(Unity)