2D Toolkit Forum

2D Toolkit => Support => Topic started by: kamankily on March 29, 2014, 09:08:21 am

Title: Prevent a click from going through gui
Post by: kamankily on March 29, 2014, 09:08:21 am
I am making a "pause panel" for my app. When pause panel show up, it should prevent player from clicking/touching other stuffs except few buttons in pause panel, but I dont know how to make it (it always click through pause panel). Can you help me fix this?

Thanks
Title: Re: Prevent a click from going through gui
Post by: unikronsoftware on March 29, 2014, 11:48:47 am
Create a big invisible collider and place it behind your pause panel. tk2d UI uses ray casts to detect presses, all you need is something to block it.
Title: Re: Prevent a click from going through gui
Post by: kamankily on March 29, 2014, 03:27:51 pm
I added a big invisible collider (a zero opacity image) and set a Box Collider component with image size, then put it behind my pause panel (checked layer order to make sure it behind pause panel and above all others). But I can click throught the pause panel, do I need so something more?
Title: Re: Prevent a click from going through gui
Post by: kamankily on March 29, 2014, 03:32:27 pm
Never mind, I just try to set z value of position and it worked. Thank for supporting me.