2D Toolkit Forum
2D Toolkit => Support => Topic started by: vivaldi on February 06, 2014, 07:09:29 pm
-
Hello,
I have array of tk2dUIItem:
public tk2dUIItem[] targets;void OnEnable(){
for(int i = 0;i < targets.Length; i++){
targets[i].OnClick += targetClicked;
}
}
void OnDisable(){
for(int i = 0;i < targets.Length; i++){
targets[i].OnClick -= targetClicked;
}
}
How can I detect which button was pressed in my "targetClicked" method?
Thanks.
-
Ok, looks like i found solution.
I use OnDown instead OnClick and than in "targetClicked" get pressed stance
targets[i].IsPressed
-
You can just use OnClickUIItem, that passes you the UIItem that called the event. No need to hack around for this.