Version: 5.3 (switch to 5.4b)
ЯзыкEnglish
  • C#
  • JS

Язык программирования

Выберите подходящий для вас язык программирования. Все примеры кода будут представлены на выбранном языке.

ScriptableWizard.OnWizardOtherButton()

Предложить изменения

Успех!

Благодарим вас за то, что вы помогаете нам улучшить качество документации по Unity. Однако, мы не можем принять любой перевод. Мы проверяем каждый предложенный вами вариант перевода и принимаем его только если он соответствует оригиналу.

Закрыть

Ошибка внесения изменений

По определённым причинам предложенный вами перевод не может быть принят. Пожалуйста <a>попробуйте снова</a> через пару минут. И выражаем вам свою благодарность за то, что вы уделяете время, чтобы улучшить документацию по Unity.

Закрыть

Отменить

Руководство

Описание

Allows you to provide an action when the user clicks on the other button.

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 || firstObject == 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() { return; } }