"Phantom" mouse cursor/touch on iOS but not Android?

Hi!

I’m having trouble with the iOS port of our game - we’re making it for iOS, Android and also Web. We started off with Web, and I tried to make sure we were dealing with inputs responsibly: I’m dealing with inputs in the OnGUI scope (as this means we won’t “skip” any clicks if the frame rate drops suddenly), looking at Event.current to deal with mouse button clicks one at a time.

We also deal with touch controls in this scope, and this mostly works fine on Android (multi touch works fine). Within our in internal GUI system we generate more “generic” click events based on either touches or mouse buttons (pressed down or released), so that touches and mouse button clicks are abstracted into the same format and (mostly) dealt with generically.

However, on iOS, touches in the OnGUI scope seem to only respond to the FIRST touch. Multiple touches seem to “average out” the position of the touch, rather than being proper touches. Buttons we’ve created register as “hovered over” even when the touch is released (and our code explicitly performs a “hover off” on “release” if it’s on the mobile platforms).

(Still on iOS) When we move the touch generation code into Update() instead of OnGUI(), we DO get multi-touch response, but the On GUI aspect still filters through (I’m going to try TOTALLY turning off touch generation from OnGUI in iOS, next).

So in general, it seems like if you’re using OnGUI on iOS, you’re getting a “fake” mouse cursor which takes the average position of all touches, and the cursor is “left behind” in the last known position, but you can’t actually get access to the true touches anywhere other than the Update() loop. And this is not the case on Android!

So I guess my question is: What is going on with the fake mouse use in OnGUI? What’s the rationale? If it’s meant to be an ease of use thing, why does it only occur on iOS and not android?

And most importantly, how can I turn off this “fake” mouse cursor?

Ooh,

According to everyone’s favourite unity forum curmudgeon, OnGUI is implicitly not for multitouch. I shall just shift my input code into Update for mobile stuff, and have to live with the lost touches. sigh. [Edit] Yep. that worked! Luckily our frame rate is pretty high so we’re not missing much. Ideally, I guess you wanna cache touches yourself incase TouchPhase.Began gets skipped? Kinda generate your own version of begin/end touch based on whether the touches are active this frame vs. last?

Weird that getting touches from OnGUI DOES work on android, though?