2D Toolkit Forum
2D Toolkit => Support => Topic started by: Martin on September 04, 2013, 02:11:46 am
-
I could not find it in the documentation, is that something possible? I tried to use CollapseList() but nothing happen.
-
Hi Martin,
I'm not sure exactly what you did with 'CollapseList' but I have managed to get it working. I just created a simple script that will collapse the list when 'x' is pressed:
public class DropDownMenuCollapse : MonoBehaviour {
public tk2dUIDropDownMenu ddm;
void Update ()
{
if(Input.GetKey("x"))
{
ddm.CollapseList();
}
}
}
Bear in mind that in tk2dUIDropDownItem, CollapseList is a private function so in order to make it work like in the example you will need to change it to public.
Hope this helps.
-
Yep, that works! Thanks :)
I'm using code on a collider to close the dropdown if the user click outside of the dropdown. Any chance CollapseList() to be made public on future release?