Unity has a component called Button as part of its UI system which you can use to subscribe on-click events to it through the inspector which is incredibly useful.
However, when projects get larger, I run into trouble in many situations:
- events subscribed this way in the inspector are not rearrange-able which makes buttons that have lots of events difficult to manage
- changing the contents of the scripts used for events can cause the button to not recognize a function that was used for an event which means you have to re-reference it
- if anything happens to the GameObject or prefab that stores the Button component such as it getting corrupt then all your events that were serialized onto the button would be wiped and you would need to re-reference all of them
- the above points make debugging very very difficult
What are some ways I can work around the problems I've listed above?