The problem is simple: new UI system has cool buttons, but if I want to really use them I need to be able to add onClick events by code. Why? Well if I know I can atach script to the button in the editor, but most of the stuff must be created after the game is started. And even if I go around it premaking all the buttons it would be nice to have just one script… not multiple scripts for every button.
in short: how do I modify/add event to this thing?
GetComponent().onClick
in ToolButton scripts on Start() function you need to add Addlistener to each button
UnityEngine.Events.UnityAction action = () => { Play();};
GetComponent ().onClick.AddListener (action);