News: Enjoy our Christmas offer 30% off on our latest package Tower Defense Level Kit http://u3d.as/m7h

  • May 24, 2018, 12:20:16 AM

Login with username, password and session length

Author Topic: EasyTouch and Unity 5 UI  (Read 7092 times)

Offline Wilbert

  • Newbie
  • *
  • Posts: 1
EasyTouch and Unity 5 UI
« on: June 03, 2015, 08:18:46 AM »
    I'm having trouble getting EasyTouch to work with the (new) Unity GUI.
    Do I have to switch 'Enable Unity UI detection' on or off?
    Do I have to switch 'Enable 2D collider' on or off?

    • I created a test project with a UI canvas and one Panel.

    • I added EasyTouch



  • I added a simple script to the panel
  • I added an Easy Touch Trigger with an On_Swipe event




When I run the project nothing happens if I click the panel. Even the print statement doesn't run.

What am I doing wrong ?
(Can I send the testproject somewhere ? (I don't want to 'give away' EasyTouch ;-)

[/list]
« Last Edit: June 03, 2015, 08:58:35 AM by Wilbert »

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: EasyTouch and Unity 5 UI
« Reply #1 on: June 04, 2015, 12:06:57 PM »
Hi Wilbert,
 

If you want to detect gestures on the GUI Elements you must:
* Enable Unity UI detection
* Disable Unity UI compatibility (when enable, EasyTouch doesn’t raise gesture message when your touch is over UI Element)
 
 
EasyTouch trigger doesn’t work with Unity UI (I prepared a specific trigger to work with the GUI element), you have to create your own script like that :
 
void OnEnable(){
    EasyTouch.On_DragEnd += HandleOn_DragEnd;
}
 
void HandleOn_DragEnd (Gesture gesture)
{
    if (gesture.pickedUIElement != null){
        Debug.Log("ok");
    }
}
 
Regards,
 
Nicolas