Author Topic: Clueless about why Slider's collider isn't working  (Read 4729 times)

Lohoris

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 11
    • View Profile
Clueless about why Slider's collider isn't working
« on: August 28, 2014, 06:33:14 AM »
I've created a Slider following these instructions.

It mostly works, but it doesn't get the clicks.

It does have a box collider trigger, which is as big as the slider itself.
If I manually change the value via inspector, it behaves correctly and sends the notification.

It apparently just doesn't get the click.

This is likely a silly mistake, something simple I'm missing, but currently I don't know where to look... any advice?

PS: for some reason I had to set the foreground sprite as Tiled instead of Sliced, since it was shrinking instead of cropping while it was Sliced.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Clueless about why Slider's collider isn't working
« Reply #1 on: August 28, 2014, 09:14:53 PM »
Sliced sprites don't get cropped. They get resized. Filled sprites get cropped.

Set UICamera's "Debug" option to true to see what is intercepting your events. The collider needs to be on the same object as your slider for it to work. If other widgets also don't get events, check the FAQ regarding the physics options (raycast hit triggers).

Lohoris

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Clueless about why Slider's collider isn't working
« Reply #2 on: August 29, 2014, 03:27:56 AM »
Set UICamera's "Debug" option to true to see what is intercepting your events. The collider needs to be on the same object as your slider for it to work. If other widgets also don't get events, check the FAQ regarding the physics options (raycast hit triggers).
The collider is in the same object, and other widgets get events.

However I've noticed that this object is in a panel which is separated from the rest of the UI, and it's 3D: rendered by the main camera, in the default layer.
I'm pretty sure this is what causing the problem.

I've convinced the team that this did not make any sense, and we're switching to a 2D UI, so I guess it will work once I do that.
If it doesn't, I'll go on with the questions ;)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Clueless about why Slider's collider isn't working
« Reply #3 on: August 30, 2014, 08:55:20 AM »
Yup, that would most certainly do it.