Version: 2022.3
言語: 日本語

説明

ユーザーが他のボタンをクリックしたときにアクションを提供できます

This is the place where you can implement all the stuff that will be done if the user clicks the secondary option when calling DisplayWizard.

See Also: ScriptableWizard.DisplayWizard


ScriptableWizard with an "Other" button, in this case named "Info".

// Display a window showing the distance between two objects when clicking the Info button.

using UnityEngine; using UnityEditor;

public class ScriptableWizardOnWizardOtherButton : ScriptableWizard { public Transform firstObject = null; public Transform secondObject = null;

[MenuItem("Example/Show OnWizardOtherButton Usage")] static void CreateWindow() { ScriptableWizard.DisplayWizard("Click info to know the distance between the objects", typeof(ScriptableWizardOnWizardOtherButton), "Finish!", "Info"); }

void OnWizardUpdate() { if (firstObject == null || secondObject == null) { isValid = false; errorString = "Select the objects you want to measure"; } else { isValid = true; errorString = ""; } }

// Called when you press the "Info" button. void OnWizardOtherButton() { float distanceObjs = Vector3.Distance(firstObject.position, secondObject.position); EditorUtility.DisplayDialog( "The distance between the objects is: " + distanceObjs + " Units", "", "Ok"); }

// Called when you press the "Finish!" button. void OnWizardCreate() { } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961