Author Topic: How to response the OnHover in item container when dragging item!  (Read 5151 times)

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
How to response the OnHover in item container when dragging item!
« on: September 25, 2012, 01:16:34 AM »
I creat a class like UIItemSlot, How to response OnHover  in  item container when dragging item, i try to user OnHover in My class,but i doesn't work when dragging.
i can use OnMouseOver to resolved.But have any easy way to get it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to response the OnHover in item container when dragging item!
« Reply #1 on: September 25, 2012, 08:15:44 AM »
When you start the drag process, disable the dragged object's collider and set UICamera.selectedObject = null in addition to UICamera.currentTouch.pressed = null. This clear the reference to what's being dragged, and you will be receiving OnHover events on your items.

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
Re: How to response the OnHover in item container when dragging item!
« Reply #2 on: January 09, 2013, 12:16:39 PM »
It's my code in below: But the item still can't receive the OnHover when Mouse Pressed dragging, They would be fine when the Mouse Released ,
UICamera.selectedObject = null;
UICamera.currentTouch.pressed = null;
BoxCollider bc = GetComponent<BoxCollider>();
bc.enabled = false;
bc.isTrigger = false;

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to response the OnHover in item container when dragging item!
« Reply #3 on: January 09, 2013, 03:25:26 PM »
I think you might have to dig deeper into the sequence of events to figure out what's happening in your case.