* Edit: I solved this. Solution is in the reply *
Greetings,
I have a settings screen in my game where I allow the user to select what type of mobile control they want to use:
When clicking a button (it’s a TextMeshPro button) it displays using it’s Selected Color:
I am saving the selected setting and loading it at runtime so I would like the button for the currently selected setting to be “selected” (i.e. display it’s selected color) when the settings screen is loaded.
I see in the inspector debug view a hasSelection property which gets checked when it’s selected:
I have not found a way to set that via code. I’ve tried calling .Select() on the button component itself. I’ve also tried EventSystem.current.SetSelectedGameObject() on the button’s .gameObject.
Neither of those approaches worked for me:
My googlefoo has failed me so far.
I’m sure I’m overlooking something obvious and would appreciate someone pointing me in the right direction.
Thanks,
–Midnite