YarnSpinnerTool / YarnSpinner-Unity

The official Unity integration for Yarn Spinner, the friendly dialogue tool.
MIT License
524 stars 91 forks source link

possibility to add numbers to the options displayed text & select options by code #267

Closed praschl closed 9 months ago

praschl commented 9 months ago

This commit adds the possibility to give each option a number, like "1. Yes sure" "2. Maybe" "3. No definitly not"

The numbers are generated automatically for selectable options, when the addNumbersToOptions flag is true.

It also adds two methods that can be used to select the options by code. I am using it like this in my project where I have the new InputSystem set up so the user can press 1-5 on the keyboard to select an option. This will not click the buttons, so I need a way to select them by code when the key is pressed. The second method always selects the last displayed option.

If this is a change you would accept, I will also add the required tests, docs etc, before you actually merge it, of course. Just want to make sure the feature itself (and its implementation) is acceptable before I go through that :-)

regards, Michael

praschl commented 9 months ago

moved commit to a branch of main