Author Topic: UIButtonColor change target color when drag in.  (Read 2764 times)

Kichang Kim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
UIButtonColor change target color when drag in.
« on: February 06, 2014, 06:07:05 AM »
Hi. I found some odd working of UIButtonColor.

Normally, UIButtonColor does not change target color when I move mouse to it while mouse button is down (drag in).

But when I set  my own event receiver to UICamera.genericEventHandler, all of UIButtonColor change target color with drag. Is this bug?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButtonColor change target color when drag in.
« Reply #1 on: February 06, 2014, 09:33:18 PM »
UIButtonColor colors the object in a pressed state when you drag something over it, whether the generic event handler is set or not.

UIButton doesn't do it by default, unless you set "Drag Over" to "Press".

Kichang Kim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: UIButtonColor change target color when drag in.
« Reply #2 on: February 06, 2014, 11:08:37 PM »
UIButtonColor colors the object in a pressed state when you drag something over it, whether the generic event handler is set or not.

UIButton doesn't do it by default, unless you set "Drag Over" to "Press".

Hmm... when I commenting my code at UICamera.genericEventHandler = gameObject, This is not occurred.

I'll check Drag over setting. How check that setting?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButtonColor change target color when drag in.
« Reply #3 on: February 06, 2014, 11:09:14 PM »
It's an option on UIButton. UIButtonColor doesn't have it.

Kichang Kim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: UIButtonColor change target color when drag in.
« Reply #4 on: February 07, 2014, 04:26:59 AM »
I check my UIButton scripts, and all of that's drag over options is do nothing. When I drag over, it changes color of sprite only, does not call OnClick event.

This only occurred when I set my custom event receiver (Player gameobject) to UICamera.genericEventHandler.

Should I need to do something about my custom event receiver?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButtonColor change target color when drag in.
« Reply #5 on: February 08, 2014, 02:12:13 PM »
OnClick event is never sent as a part of a drag. You get OnDragOver when you drag something over, and OnDragOut when you drag away.