Skip to content

Fixes OptionButton selection index being reset to zero at instanciation

Created by: Alexander-Alekseev

What we want to see is:

  • Create OptionButton;
  • Add items;
  • Select desired item.

Till you are in GUI, the logic flow is correct. When you click Save Scene and/or Run Project the logic flow is:

  • Create OptionButton (yes, save/run option creates a new one);
  • Select desired item; <-- it fails because there are no items in popup as @bojidar-bg mentioned
  • Add items. <-- when you have more than 1 item, this one selects item with index == 0

The root cause is that properties in OptionButton class placed in the order:

  1. selected (_select_int method);
  2. items (_set_items method).

Engine executes properties in this order once we save scene/run project.

This fix changes the order.

Bugsquad edit: fixes #10213 (closed)

Merge request reports