Use UnityEvent.AddListener to extend the onClick click events. The added UnityAction is called when the Button press is released. A Button can have multiple listeners. As an example, in the script example below, btn3 can have TaskOnClick added as a second
Adding multiple identical listeners results in only a single call being made. //Attach this script to a GameObject //This script creates a UnityEvent that calls a method when a key is pressed //Note that 'q' exits this application. using UnityEngi
Last thing - in my case, the TestMethod I defined simply prints a log. When clicking the button, it logged the message, but in the Button's inspector i could not see any onClick event listed. This probably just means that the inspector is not refreshe
Post a Comment:
Showing 0 Comments: