Lag at First Touch (Android)

Hello,I have noticed that the first time I press a button there is a lag spike.
After the first initial lag spike the lag goes away and I can press the button freely with no lag spikes … Why is this happening? Is it a bug ? Has anyone found a solution for this problem ?
I am using Unity 5.0.2.

I have this problem in 2018 and I profiled it and it is EventSystem.Update(). When i touch the screen for the 1st time it creates a 200ms delay. How do we fix this?

Sounds like a memory issue. Did you profile it?

First you need to attach to your device with Unity profiler. It will tell you want is going on when you are pressing that button. There are few things which could add noticeable lag: dynamic font generation, UI mesh generation etc. Without profiler info it’s impossible to tell.

The problem is not on EventSystem, this occurs when you have a Text GameObject that loads a font for the first time, so probabily after you press the button you create or have a GameObject that has a Text component. The lag is due that it has to load the font into memory for the first time. Check Incl. Font Data for the Font in the Fonts folder.

In my case the lag was caused by Mono build in player settings. IL2CPP build fixed it. And I disabled the “Raycast Target” for the objects which doesn’t need it. This will reduce the EventSystem effort/Update.