So I've got a load menu using Unity's new UI system, basically just a list of save games you can select with a mouse click along with a couple of buttons at the bottom to delete or load the selected game file.
I've been disabling the Load Game and Delete Game buttons using the interactable attribute whenever a saved game item in the list is deselected:
deleteButton_LoadPanel.GetComponent<Button>().interactable = false; loadButton_LoadPanel.GetComponent<Button>().interactable = false;
This disables the buttons fine, but when I click on a saved game and then click a button, the deselect event for each save file is triggered BEFORE the onclick event for each button. This is no good.
If I have no deselection event for each individual save file I can click on each save file and then click the load or delete buttons and every thing works fine, but the buttons never get disabled which is not ideal.
My question is: How can I disable the buttons when an item is deselected, but still trigger the onclick event when they are selected? Are there any workarounds to this?