- Home /
Windows 7 touch not working correctly in WebGL!
I'm creating a touch controlled application on Windows 7. I've met a simple problem, which probably does not have a simple solution... When I build the application as a standalone exe, the touch input works as expected - The same way it works if I build it to a mobile device. The problem is, I need to build it to WebGL in it's final form, but when I build it to WebGL, uGui does not respond to touch input and general touch input does not act as expected. It's almost like Unity is always detecting an extra "ghost" input! As a "solution", I've tried implementing the TouchScript plugin, but while uGUI "works" (Vertical touch input is reversed), other touch input gestures do not. Not even in TouchScripts own examples. I've also tried simply using mouse input instead, as the app is running on a pc, but no luck.
UPDATE: I created a new Unity project and simply printed debug information to a UI text. My results:
Chrome
Touch count: Starts as zero, and outputs the correct amount of touches, as well as their correct delta positions. However, when all fingers are released, it still registers one touch input, confirming my "ghost touch" theory.
Mouse input: No mouse input registered from touch, but correctly registered if a mouse is plugged in and used.
Firefox
Touch count: None! In Firefox no touch is registered at all! Instead,a single touch is registered as a click of the left mouse button, but is immediatly unregistered. AKA: Holding down a finger, does nothing.
Mouse input: Registers mouse input as normal. Any ideas? I really need this solved quickly, but I've got no more ideas.
UPDATE: This thread and this thread describe part of the issue(s) - Supposedly fixed in 5.3. Whether that's the case or not, I can't wait for 5.3 to be released. I'm going to try the 5.4 beta, but as of this moment, trying to download the WebGL tools for the beta, returns a server error.
UPDATE: Okay so current "solution" is to go back to Unity Web Player. Using an old version of Chrome it all seems to work! However (As talked about in this thread I can't show HTML over top of the player in Chrome. But I can in Firefox, but... Firefox doesn't register touch input?! Touch registers as a mouse click...
One step forwards, one step back...
UPDATE: Taking the current mouse position minus the previous position, I am back to being able to drag my finger across, despite mouse axis' not registrering. Next problem. The HTML overlay works only until the web player is first "clicked" (activated), after which the html overlay no longer accepts input, it is captured by the player behind it. My latest attempt at overcoming this, is to call Cursor.lockState = CursorLockMode.None; every frame, but no luck. Why doesn't that work...
LATER UPDATE: If anyone was curious, I solved this by downgrading Firefox to version 42.0 and disabling updates. Then switching to WebPlayer, and building the project in a resolution, that doesn't overlap with the HTML elements. Time and budget permitting, I will try WebGL at a later date in version 5.3 and above.
Answer by prinzwurstbrot · Dec 26, 2015 at 11:12 AM
Have you tried getting the touch event in html and forward that data to your function (mouseOrbit or similar) using send message. That was once a workaround for mac because safari blocked all whe mouse wheel input events.
Your answer
![](https://koobas.hobune.stream/wayback/20220612043144im_/https://answers.unity.com/themes/thub/images/avi.jpg)