Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Lord_Meshadieme on March 21, 2013, 01:04:13 PM

Title: Disable dragging by code
Post by: Lord_Meshadieme on March 21, 2013, 01:04:13 PM
Hello people,

Using nGUI's DragObject Script to drag something, how would i stop this dragging by code, or if the touch event is not in the hover state any more. i know it has to do with the UICamera event but for the heck of me i can't figure out how dragging stops from the drag object script. I'm definitely stepping on my own foot here sigh.

Regards.
Title: Re: Disable dragging by code
Post by: ArenMook on March 22, 2013, 02:07:09 AM
Search for "OnDrop" event within the UICamera. I'm guessing in your case you will want to just set UICamera.currentTouch.pressed to null though.
Title: Re: Disable dragging by code
Post by: PabloAM on March 27, 2013, 07:05:30 AM
And what is the way to re drag it still being pressed and over the collision ??

I just need to activate UIDragObject on runtime when the touch is inside the collision but is up to 75% of the localScale.
when I got more than 75% call to drag.enabled = true, but the object doesn´t get draggable.

Any reply would be awesome.

FIXED:

  1.         drag = GetComponent<UIDragObject>();
  2.  
  3.         drag.enabled = true;
  4.                                                        
  5.         SendMessage("OnPress",false,SendMessageOptions.DontRequireReceiver);
  6.                                
  7.         SendMessage("OnPress",true,SendMessageOptions.DontRequireReceiver);
  8.  
  9.  

Thanks