Hello Guest

Author Topic: Prevent a click from going through gui  (Read 3657 times)

kamankily

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Prevent a click from going through gui
« 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Prevent a click from going through gui
« Reply #1 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.

kamankily

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Prevent a click from going through gui
« Reply #2 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?

kamankily

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Prevent a click from going through gui
« Reply #3 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.