- Home /
RPG Maker style menu with UI buttons that are selected by controller
Hey guys, I've made some serious progress on an RPG menu I've been working on. My project is moving along pretty steady but now and then I hit these frustrating roadblocks that I feel should be easier to deal with than they are.
Basically, I have this RPG menu that when opened runs:
Eventsystem.current.SetSelectedGameObject(mymainmenubutton);
In my case, mymainmenubutton is equipBtn because this is the first button on my list. This works fine, returns correctly and does what it's supposed to do.
Upon opening my item menu, I struggled to get access to Scrollview and make it follow the selected button around but I managed to get that to work. All is well, but I need to update item descriptions and select the first item in the list, but the items are instantiated as buttons from a list: List;
I can not for the life of me figure out how to select the first UI Button from the item list. Have I gone about this all wrong? Is there a better way I could have done this?
Anyway, I tried:
Button button;
button = GetComponentInChildren<Button>();
button.Select();
To no avail. Looking for guidance.
Your answer
Follow this Question
Related Questions
UI Element Got & Lost Focus Handling 2 Answers
Selecting a selectable using script doesn't seem to work anymore? 1 Answer
Button is not being clicked. 1 Answer
Unity - destroy clone child object (button) 1 Answer
Click on image in scrollview 0 Answers