Easy Touch 4 with UGui

I have been trying to get the drag events to work on a panel with UGui without success. Simple tap and swipe are working fine but Drag is not responsive.

I have a Panel with a script attached to it that handles all the drag, tap events etc. There is a text area and an image as children of the panel. Another issue is that the pickedUIElement is always the child of the panel I have my script attached to and I want to only perform the drag, tap, etc. actions when the parent (which has the script attached to it) is interacted with not against the image or text area. Does drag simply not work with EasyTouch and UGui? Below is my script/code that is attached to the panel:

// Drag is never fired, if I set this to be the swipe event it works....
	void On_DragStart( Gesture gesture){
		Debug.Log ("On_DragStart " + gesture.position);
		
                // ***this always picks the child element, gameObject is the object script is attached to which I want to test against
		if (gesture.pickedUIElement == this.gameObject){
			fingerIndex = gesture.fingerIndex;

			Debug.Log ("On_DragStart 1111 " + gesture.position);
			// the world coordinate from touch
			Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedUIElement.transform.position);
			deltaPosition = position - transform.position;

		}	
	}

	// During the drag
	void On_Drag(Gesture gesture){

		// Verification that the action on the object
		if (gesture.pickedUIElement == this.gameObject){
		
			// the world coordinate from touch
			Vector3 position = gesture.GetTouchToWorldPoint(gesture.pickedUIElement.transform.position);
			transform.position = position - deltaPosition;


			// Get the drag angle
			float angle = gesture.GetSwipeOrDragAngle();

			Debug.LogFormat(angle.ToString("f2") + " / " + gesture.swipe.ToString());
		}
	}

	// At the drag end
	void On_DragEnd(Gesture gesture){

		if (gesture.pickedUIElement == this.gameObject){
			Debug.Log("On_DragEndOn_DragEndOn_DragEnd");
		}
	}

Posting the answer to this in case anyone else has a similar issue…

Hi,

Do you have look at my examples UIcompatibility & UITwistPinch ? For these examples there is the script : UIDrag.cs

Another issue is that the pickedUIElement is always the child of the panel I have my script attached
It doesn’t come from EasyTouch but how the new GUI work. The raycast against the new GUI returns the first element in view, in your case they are the children of your panel, otherwise your child would be behind the panel. More of this also depends on how you handled the component GraphicRaycaster on you UI Element.

If you look at my examples & UIDrag.cs, I do this test to know if the pickedUIelement is on the gameobject with mys script or his child :

if ((gesture.pickedUIElement == gameObject || gesture.pickedUIElement.transform.IsChildOf( transform))

This allow to enable you action wherever if you touch on you panel.