When developing a mod for cities: Skylines, I ran into a problem.
Most of my code, as far as I can tell, works great, but so far I don't need to check it. This is due to the fact that all this must be called up sequentially when the button added to the user interface is pressed. The click event on this button does not call the handler that I assigned to it.
Here I create a button:
public class LoadingExtension : LoadingExtensionBase { public override void OnLevelLoaded(LoadMode mode) { Debug.LogDebugMessage("Adding 'Generate City Report' button to UI");
According to the documentation, I am tracking using
button.eventClick += ButtonClick;
should add ButtonClick as a click handler for the button. However, pressing the button does nothing. A debug message at the beginning of the handler (the message "HIGH LOGIC") is not displayed (note: an earlier debug message about adding a button to the user interface). Error messages are not displayed on the debug panel of the game, nor in VS.
I also tried using new MouseEventHandler(ButtonClick) , since the inline VS documentation tells me that the eventClick type is MouseEventHandler . It does not show errors in VS or game, but also does not work.
(Note: official documentation, but this is next to useless.)
Does anyone have any experience with the C: S API? Why is this event not triggered?
source share