So as I was debugging a prior issue I saw some weird behavior which definitely slowed down my debugging. Here is what happens:
The unit selection changes, which causes the selected unit to change. Then the selected Action gets changed which then fires off a selected action change event BEFORE the selected unit change event has triggered.
I guess I could see why this is done. But it is causing the UpdateSelectedVisual() code to be run twice, the first time with stale data on the actionButtonList, the second time with correct data. It doesn’t seem to make sense to disable the stale buttons since you’ll destroy them anyway correct.
The problems it seems to create is
- a bit of a performance penalty running code for objects that are just about to be destroyed
- it slowed down my debugging for an unrelated issue because the code flow was unexpected
But I can’t think of a simple way to fix this. Curious on thoughts here.