playMaker

Author Topic: Prevent clicks behind UI panels and buttons [SOLVED]  (Read 1976 times)

Alatriste

  • Full Member
  • ***
  • Posts: 193
Prevent clicks behind UI panels and buttons [SOLVED]
« on: March 12, 2019, 03:05:18 PM »
Hi,

I'm having some issues with my settings panel not stopping the interaction with the objects placed behind it. I was looking for answers, but I couldn't make anything to work (people was sharing scripts to kind of hack this behavior), and I don't know if there is a clean way to do this using playmaker.

Thanks!
« Last Edit: March 13, 2019, 05:16:10 AM by Alatriste »

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Prevent clicks behind UI panels and buttons
« Reply #1 on: March 12, 2019, 03:14:13 PM »
are you doing a 2d game?
use graphic raycaster on your UI
what is the setup of your canvas? is it an overlay? screen? world?

Alatriste

  • Full Member
  • ***
  • Posts: 193
Re: Prevent clicks behind UI panels and buttons
« Reply #2 on: March 12, 2019, 04:45:03 PM »
Yes, it's a 2D game.
I'm using the raycaster on my panel, but somehow the triggers behind they still get activated.
The "Canvas Settings" is the parent and the "Panel Settings" is the child, which is just a black panel with transparency that should stop any interaction behind it.
« Last Edit: March 12, 2019, 04:48:47 PM by Alatriste »

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Prevent clicks behind UI panels and buttons
« Reply #3 on: March 12, 2019, 04:54:17 PM »
can you send the SS of the object behind it?
the one that keep getting clicked

Alatriste

  • Full Member
  • ***
  • Posts: 193
Re: Prevent clicks behind UI panels and buttons
« Reply #4 on: March 12, 2019, 05:29:16 PM »
Sure thing.
The "Clickable 2D" script is added by Fungus (a VN addon), which basically set the object so it can be referenced by the Fungus editor.
« Last Edit: March 12, 2019, 05:37:02 PM by Alatriste »

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Prevent clicks behind UI panels and buttons
« Reply #5 on: March 12, 2019, 06:04:36 PM »
Can you try to remove the script and use normal collider for the item and see if it works?  I believe there something on the script that causes all of this. unless looking at the script, its hard to tell.

Have you tried to check the ‘use event system’ on the clickble script ? It is an input module for unity, who knows if it might produce something magic.

Finally, you can use trick like disable the clickable component if the setting panel pop up. And enable it again once you are done

Good Luck
« Last Edit: March 12, 2019, 06:17:33 PM by ch1ky3n »

Alatriste

  • Full Member
  • ***
  • Posts: 193
Re: Prevent clicks behind UI panels and buttons
« Reply #6 on: March 12, 2019, 06:24:11 PM »
You were right! "Use Event System" made trick! I cannot believe I missed such an obvious option!  :-[ Thanks for taking the time to look into my problem. :D