Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Dethanos on July 23, 2014, 04:46:22 PM

Title: UIDragDropItem - Event when registered to new parent
Post by: Dethanos on July 23, 2014, 04:46:22 PM
Good Day,

I am using the UIDragDropItem script ( 3.6.8 ) and I would like to receive a event when my object is moved to a new parent so I can perform some actions at this point.

The way I have done this is, in UIDragDropItem script in the method OnDragDropRelease (GameObject surface) I have added the following highlighted line

  1.             if (container != null)
  2.             {
  3.                 // Container found -- parent this object to the container
  4.                 mTrans.parent = (container.reparentTarget != null) ? container.reparentTarget : container.transform;
  5.  
  6.                 Vector3 pos = mTrans.localPosition;
  7.                 pos.z = 0f;
  8.                 mTrans.localPosition = pos;
  9.  
  10.                 SendMessage("OnSubmit", this.gameObject); <--- New line
  11.             }

Would this be something that could be added or is there a way of doing this already that I am missing?

Cheers,



Title: Re: UIDragDropItem - Event when registered to new parent
Post by: ArenMook on July 23, 2014, 09:14:01 PM
You should derive from UIDragDropItem and overwrite its OnDragDropRelease function the same way ExampleDragDropItem does it.
Title: Re: UIDragDropItem - Event when registered to new parent
Post by: Dethanos on July 26, 2014, 06:01:23 PM
yep... soz :)