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

  • June 22, 2018, 08:46:39 PM

Login with username, password and session length

Author Topic: Easytouch doesn't work on Windows Store apps  (Read 2097 times)

Offline lordnedox

  • Newbie
  • *
  • Posts: 3
Easytouch doesn't work on Windows Store apps
« on: April 21, 2016, 03:53:48 PM »
Hi,
first of all compliments for this beautiful library.

I have no problems with Android, iOS, Windows Phone and even Windows standalone build.

However on Windows Store apps (Universal builds running on Windows) the library doesn't work as it does on a Windows Standalone client.

The problem is that the compilation symbol WIN_RT is true, so it falls under the standard touch input controls instead of the mouse input. There is no compilation symbol specific to be used, because universal apps 10 run on both phone and PC.
As a result, Input.touchCount is always zero on PC.

I will try to fix this myself by adding an extra check Input.touchSupported == true in case it's WIN_RT. If it returns false, I will fallback to the mouse input emulation.

Would like to hear your opinion on this, and if you see a better workaround.

Many thanks








Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Easytouch doesn't work on Windows Store apps
« Reply #1 on: April 21, 2016, 05:09:58 PM »
Hi,

EasyTouch siwtch automaticaly between mouse simulation and real touches. This is done by these line in Update method


Code: [Select]
if (Application.isPlaying && Input.touchCount>0){
enableRemote = true;
}

if (Application.isPlaying && Input.touchCount==0){
enableRemote = false;
}

When remote is equal true, the realtouch is used. So it means that when you're under  WIN_RT unity api Input.touchCount always return 0.

More the touch detection is force in EasyTouch for Win_RT (http://docs.unity3d.com/Manual/PlatformDependentCompilation.html)
         #if (((UNITY_ANDROID || UNITY_IOS || UNITY_WINRT || UNITY_BLACKBERRY || UNITY_TVOS) && !UNITY_EDITOR))
            UpdateTouches(true, count); // force to try to catch touches from touch screen
         #else
            UpdateTouches(false, count);
         #endif   

So I don't what I can do, are you sure that Unity correctly manage touches with WIN_RT ?
« Last Edit: April 21, 2016, 05:14:53 PM by Nicolas »

Offline lordnedox

  • Newbie
  • *
  • Posts: 3
Re: Easytouch doesn't work on Windows Store apps
« Reply #2 on: April 21, 2016, 06:39:20 PM »
Hi Nicolas,

On universal apps, unity returns touchCount > 0 on phones, and touchCount == 0 on desktop. But there is no compilation symbol to check, as they both fall under WINRT.

Actually now the problem is fixed, I changed the code to something like this:

Code: [Select]
#if UNITY_WINRT
  if(Input.touchSupported) {
     UpdateTouches(true, count);
} else {
     UpdateTouches(false, count);
}
#elif (((UNITY_ANDROID || UNITY_IOS || UNITY_WINRT || UNITY_BLACKBERRY || UNITY_TVOS) && !UNITY_EDITOR))
            UpdateTouches(true, count); // force to try to catch touches from touch screen
#else
            UpdateTouches(false, count);
#endif


This way it works fine on both windows phone and desktop.

I hope this helps.

Regards
Marco


Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Easytouch doesn't work on Windows Store apps
« Reply #3 on: April 22, 2016, 10:45:41 AM »
Hi,

thank you, I will add it on the new release.

Offline Magic

  • Newbie
  • *
  • Posts: 7
Re: Easytouch doesn't work on Windows Store apps
« Reply #4 on: July 01, 2016, 11:27:47 PM »
Hi,

I got the same issue.. but the solution provided isn't enough :)

First, I don't understand why using #if ... in order to set the realTouch parameter, when there is Input.touchsupported.

so, instead of use:

#if (((UNITY_ANDROID || UNITY_IOS || UNITY_WINRT || UNITY_BLACKBERRY || UNITY_TVOS) && !UNITY_EDITOR))
            UpdateTouches(true, count); // force to try to catch touches from touch screen
#else
            UpdateTouches(false, count);
#endif

simply use:

UpdateTouches(Input.touchSupported, count);


anyway, even with the Marco's solution... you have to apply the same fix your Input.TouchCount(), because here you have the same problem:

#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WINRT || UNITY_BLACKBERRY) && !UNITY_EDITOR)
   return getTouchCount(true);
#else
   return getTouchCount(false);
#endif

and if "true" is passed.. then the mouse is ignored.

again, why not use Input.touchSupported flag?

in this way:

#if UNITY_WINRT
        return getTouchCount(Input.touchSupported);
#elif ((UNITY_ANDROID || UNITY_IOS || UNITY_BLACKBERRY) && !UNITY_EDITOR)
      return getTouchCount(true);
#else
        return getTouchCount(false);
#endif


or simply in this one:

return getTouchCount(Input.touchSupported);



Cristiano
« Last Edit: July 01, 2016, 11:40:33 PM by Magic »

Offline Magic

  • Newbie
  • *
  • Posts: 7
Re: Easytouch doesn't work on Windows Store apps
« Reply #5 on: July 01, 2016, 11:32:28 PM »
Doh...

Input.touchsupported is bugged since Unity 5.2.2.f1, and has been fixed with the 5.4.0

https://issuetracker.unity3d.com/issues/input-dot-touchsupported-always-returns-false-on-windows


Anyway... another question:

why don't check touch AND mouse input?
I may use a Surface, but with a mouse plugged in.. or any other solution 2-1.. or a laptop with a touch screen.

a simple "touch", should be detected with real touch and with left mouse button...



Cristiano
« Last Edit: July 01, 2016, 11:40:48 PM by Magic »

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Easytouch doesn't work on Windows Store apps
« Reply #6 on: July 03, 2016, 07:52:01 PM »
Hi,


This is actually what EasyTouch done if a touch is found, but in the case of the plateform WinRT it strength in Touch mode. The problem is that each person does not want the same thing, one wants the mouse, other than the touch, another two.

Input.touchsupported isn't the solution because each person does not want the same thing, one wants the mouse, other than the touch, another both at the same time. Do not have this platform, and not having found a  user that want to spend time with me  order to make a solution "in box", I prefer to leave it and explain how it works as rather create a bug for IOS/Android  which represents 99,5% users and request support, because I don't want to publish an update that I don' t test ...





Offline Magic

  • Newbie
  • *
  • Posts: 7
Re: Easytouch doesn't work on Windows Store apps
« Reply #7 on: July 04, 2016, 01:16:20 PM »
Do not have this platform, and not having found a  user that want to spend time with me  order to make a solution "in box"

Input.touchsupported should be used in order to decide if use Input.touch or not.

(no need to use #if #else..)

About the mouse, just a new "option checkbox" with "Enable mouse click as tap".

Really, I don't understand....

if "one wants the mouse, other than the touch, another two." just add a configurable option.. so each user can do what he wants.



Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Easytouch doesn't work on Windows Store apps
« Reply #8 on: July 04, 2016, 06:41:26 PM »
Hi,

It's not that I refuse to make a change, I refuse to release  a change that has not been tested.

But what I don't understand is that the latest version there is a mechanism to switch automatically between touch and mouse whatever platform. So either it no longer works with the latest version of Unity, and Win_RT

Before to  edit the code to add a method that is currently bugged and that does not support Unity Remote, I'd fixed this mechanism. But again, users working on this platform are very few, and don't want to spend time.

Would you be willing to spend  one hour of your time on skype with me ?






Offline Magic

  • Newbie
  • *
  • Posts: 7
Re: Easytouch doesn't work on Windows Store apps
« Reply #9 on: July 05, 2016, 12:43:57 PM »
Yes, I can. I'm from Rome (+1 GMT)

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Easytouch doesn't work on Windows Store apps
« Reply #10 on: July 05, 2016, 06:40:04 PM »
Hi,

Here my skype : nicolas.poursin

Offline Magic

  • Newbie
  • *
  • Posts: 7
Re: Easytouch doesn't work on Windows Store apps
« Reply #11 on: July 06, 2016, 06:01:21 PM »
message sent.