Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Lotti on February 10, 2014, 12:29:49 PM

Title: Drag'n'Drop problems on windows phone 8
Post by: Lotti on February 10, 2014, 12:29:49 PM
Hello! I implemented drag'n'drop watching your example...

so I extended UIDragDropItem to create my "drag behaviour" (let's call it dragItem) and everything works on editor, on iphone and android.

When i try to drag'n'drop on windows phone 8 it gives me errors saying that my class dragItem dosn't implement onDrag()!
(well it is private on UIDragDropItem so it isn't inherited, it does make sense... but why it works on other platforms??)

Thank you! :)
Title: Re: Drag'n'Drop problems on windows phone 8
Post by: ArenMook on February 10, 2014, 05:27:00 PM
Something different in Unity's handling of the common SendMessage logic on WP8? That's all NGUI does -- just uses Unity's gameObject.SendMessage("OnDrag", delta);

I'd suggest creating an example of it without NGUI (just do your own SendMessage) and submitting a bug to Unity.
Title: Re: Drag'n'Drop problems on windows phone 8
Post by: Lotti on March 26, 2014, 05:00:29 AM
after a month i can paste a "fix" for windows phone 8. i dont' remember why i fixed it like this and where i copypasted this code from, but it works. I'm doing this post as answer to a guy who asked me for a solution with a pm.

simply add this code on the class that extends UIDragDropItem
  1. #if UNITY_WP8
  2.         new void OnDrag (Vector2 delta)
  3.         {
  4.                 if (!enabled || mTouchID != UICamera.currentTouchID) return;
  5.                 OnDragDropMove((Vector3)delta * mRoot.pixelSizeAdjustment);
  6.         }
  7.         new void OnPress (bool isPressed) { if (isPressed) mPressTime = RealTime.time; }
  8. #endif
  9.