2D Toolkit Forum

2D Toolkit => Support => Topic started by: hromoydron on June 29, 2013, 08:39:57 pm

Title: Button's events
Post by: hromoydron on June 29, 2013, 08:39:57 pm
I make a script and attach it to button:
Code: [Select]
void OnClick()
{
     Debug.Log("tada");
}

but nothing happens, why?))
Title: Re: Button's events
Post by: hromoydron on June 29, 2013, 08:55:16 pm
or I should do like this:
Code: [Select]
this.OnClick += ButtonClick;
but unity want definition for OnClick

?
Title: Re: Button's events
Post by: unikronsoftware on June 29, 2013, 09:16:33 pm
The UI system uses .net events. You should read up some basics about how that works. If you want an example of it set up, look in tk2dUIDemoController.cs - there are a few examples of buttons being used there.