2D Toolkit Forum
2D Toolkit => Support => Topic started by: layola on September 16, 2013, 04:47:29 am
-
tk2dUIScrollableArea OnClickUIItem questions
hi,I want to ask how to add click Event of tk2dUIScrollableArea's child item?
here what I do is not right ?
the result is show always the first one on click ?
tk2dUIItem item= autoScrollableArea.GetComponent<tk2dUIItem>();
item.OnClickUIItem += onClickUIItem;
void onClickUIItem(tk2dUIItem item)
{
Debug.Log("click!");
var sprite= item.GetComponentInChildren<tk2dSprite>();//alway is the first itemui get this event .
anything wrong ?
-
Hi,
Basically for child UIItems you need the 'Child of Another UIItem' box checked. Check out the '5 - ScrollableArea' example in the TK2DROOT > tk2dUI_demo folder to see this in action.