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

  • August 19, 2018, 07:41:08 PM

Login with username, password and session length

Author Topic: Please reduce the gc in the EasyTouch.  (Read 445 times)

Offline watsonsong

  • Newbie
  • *
  • Posts: 2
Please reduce the gc in the EasyTouch.
« on: July 07, 2017, 03:28:40 AM »
The easytouch produce gc every frame about 160B, but it produce more gc when I touch the screen. I dig into the code and find it new Gesture object each frame when I touch the screen.
It could be better reuse the object and avoid gc untile real event happend.

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Please reduce the gc in the EasyTouch.
« Reply #1 on: July 07, 2017, 08:24:56 AM »
Hi,

GC comes from the new syntax, to always have an empty gesture structure in the current gesture if nothing happening. But I can set to null

To reduce it :
* Change line N534
 _currentGestures[0] = new Gesture();
to
 _currentGestures[0] = null;

*Change line N1553
return  obj.type == gesture.type && obj.fingerIndex == gesture.fingerIndex;
To
return obj!=null && obj.type == gesture.type && obj.fingerIndex == gesture.fingerIndex;

But If you use the new syntaxe will need to test the current gesture relative to Null.


Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Please reduce the gc in the EasyTouch.
« Reply #2 on: July 07, 2017, 08:29:11 AM »
The fixe will be available for Unity 5.6 in the next hours