Yesterday, someone asked me, Easytouch plug-in has a small bug, in fact, is not a bug, plug-in designers have long considered such a situation.
He said that simultaneous use of Easyjoystick and Easytouch will occur, when the lever is moved, touch will also trigger, that is, both produce events.
So, what to do with it. The designer had long known that this would happen, so he applied Reservedarea (reserved area).
What it means is that joystick is a rocker, so there must be an area that triggers things.
Then the area of the triggering event will be added to the reserved area.
I accidentally entered the source of the Easyjoystick, found that: verified I said before.
So, when we want to move the stick, it doesn't trigger touch, so we just have to say one sentence:
Using unityengine;using system.collections; #region Module Information/*-------------------------------------------------------- --------//Module name: touchrect//Creator: chen//modifier list://Created Date: #CREATIONDATE #//Module Description://--------------------------------------- -------------------------*/#endregionpublic class touchrect:monobehaviour{ void Onenable () { Easytouch.on_touchstart + = Mytouchstart; } void Ondisable () { unsubscribeevent (); } void OnDestroy () { unsubscribeevent (); } void Unsubscribeevent () { Easytouch.on_touchstart-= Mytouchstart; } private void Mytouchstart (Gesture Gesture) { if (Gesture.ishoverreservedarea)//Determine if the finger is inside the retention area, The previous joystick will be added to the reserved area as soon as it is activated. //So, we just return it in this reserved area and don't do anything. { return; } Then your touch function realizes //... }
OK, in fact, there is a way, is to determine whether a finger in a rect, here is more troublesome, because the joystick area is adapted to the screen, so he
Rect changes as the resolution changes, so does our rect when the resolution changes. So not advisable, but as long as you take the Easyjoystick source
Inside the variable arearect, can also be achieved. I don't speak much here.
The use of gesture.isinrect and Easytouch.isrectundertouch are desirable.
Unity-easytouch plug-in Reservedarea application (mainly to avoid the contradiction between joystick and touch)