private void SetupSkipStepPicker() { // Dropdown.onValueChanged won't be call if Dropdown.value is equal to the selected value. // Dropdown.value can't be less than 0 or grater than Dropdown.options.Count -1. // This causes the dropdown to never call onValueChanged in cases when there is only 1 transition. // By setting the value to be out of range from the "editor" instead than from Dropdown.value we ensure that Dropdown.onValueChanged is always called. skipStepPickerEditorValueField = skipStepPicker.GetType().GetField("m_Value", BindingFlags.NonPublic | BindingFlags.Instance); // When a target step was chosen, skipStepPicker.onValueChanged.AddListener(index => { // If there's an active step and it's not the last step, if (displayedStep != null && index < displayedStep.Data.Transitions.Data.Transitions.Count && displayedStep.LifeCycle.Stage != Stage.Inactive) { CourseRunner.SkipStep(displayedStep.Data.Transitions.Data.Transitions[index]); } }); }