Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Demigoth on March 26, 2014, 08:07:47 PM

Title: hide the menu when clicked outside of it
Post by: Demigoth on March 26, 2014, 08:07:47 PM
Hey guys, so I am working on my game and got this menu show up when I click an in-game object, now the menu wont dissapear until I actually use the stuff its inside, but I wanted to know if there is any way to trigger it to hide when I click outside of it.
Title: Re: hide the menu when clicked outside of it
Post by: ArenMook on March 26, 2014, 08:23:54 PM
If you give your menu focus via UICamera.selectedObject = yourMenuObject, you can then detect when it loses focus as it will receive OnSelect(false), letting you close it. That's what the popup list does as well.
Title: Re: hide the menu when clicked outside of it
Post by: Demigoth on March 29, 2014, 11:39:31 AM
Hey Aren,

but where do I put this script on, to set up the focus.
Title: Re: hide the menu when clicked outside of it
Post by: ArenMook on March 30, 2014, 07:04:23 AM
On whatever object you want to hold focus while the menu is visible -- likely the menu itself.