FPS drop after the first touch on Android

When I build development build, application starts on the device and I can play with perfect 60 FPS. If I restart this application, it starts with the same 60 FPS, but after the first screen touch, I see a huge spike caused by StadaloneInputModule, and FPS drop appears until app will be restarted.

In the timelines, as I can see, there is nothing new appears inside. All that changed is the time necessary for
Gfx.WaitForPresentOnGfxThread which increased from stable ~6ms to ~6-30ms.

I also found out that:

  • The release build has this issue even for the first launch.
  • Setting “Scripting Backend” from MONO to IL2CPP → FPS drop appears after the first touch even in the first run, without the necessary app restart.

I commented out all the “Input.%” code in my user scripts, but the issue still appears.
I would appreciate any suggestions on why it may happen.

Tested devices:
Huawei P20 Pro
Samsung Galaxy A12

UPD:

  • With approx 2-3% chance I still continue getting a stable build of the blank project that doesn’t have this issue.
  • Moving to the new Input system (use only the new in Player settings) doesn’t resolve the issue.
  • Switching from the Built-in rendering pipeline to URP doesn’t resolve the issue.
  • Exporting to Android Studio and building inside it doesn’t help.


Which unity version?
Are you using the new input system? (That’s what this subforum is made for, but you said you use Input., Which is the old input system)
If so, which version?

My bad, for sure I’m using the old input system. Should I move this thread to another subforum?
I use 2021.3.16.f1 version. But today, just to test, I imported scene into version 2023.1.0a24, the same behavior.

Is it reproducable in a blank project?
If so, make a bug report for it.
If not, compare settings etc between projects and worst case migrate the old project files to the new one and see if and when it returns.

First of all, thank you very much for the guidance on what to do.

I created a blank 3D project. Without changing any settings, I added:

  1. Canvas with one TextMeshPro button.
  2. One dummy object with one line script attached - Application.targetFrameRate = 60 on Start();
    The issue doesn’t appear without these two steps.

I switched the platform to Android, clicked “Build and Run” and run the profiler with huaweil. App started, I clicked on the button, still have a stable 60 FPS. I restarted the app, touched the screen and I see exactly the issue - FPS drops in the profiler:

But when I use this blank project, the issue doesn’t appear on samsung. I tried approx 6-7 builds of blank project, doesn’t appear. I have to clarify that with my project I tested samsung only once. I ran the profiler, restated the app, saw this issue, saved profiler results, and put this phone aside, getting back to huawei. Now I made more tests for samsung in my project and the results are f**ing bloody.

  1. Sometimes (quite rarely), the build starts with the issue and it won’t disappear.
  2. Sometimes the issue doesn’t appear even after I touch the screen but always appears later when the player dies (I cut off the spike between two records to make the difference more visible):

It’s insane. I have one problem, which behaves differently on each device. I’ve already sent my project in bug report with a link to this thread, does it make sense to send the bug report with the blank project?

On the email you got about the report you can tell that it’s semi reproducable with a blank project and that if they cannot reproduce the issue you can send that one as well.
Other than that I hope you can find a workaround. Maybe try the new input system?

Good idea, tried it even in the blank project (not using both IS, but only the new one), the same thing.

Hi, I’m having an exaclty same issue on my Huawei P20 Pro.
Had this issue in all my previous projects for almost a year (or maybe started noticing it atleast). After Build & Run even an empty project with 1 cube and no canvases runs silky smooth after first tap. Restarting it causes this issue.
Removing EventSystem solves this issue, but of course I can’t use any inputs.
Spent last 2 days trying to solve it, but no luck. Wonder if it’s only happening on certain devices.

Build & Run:

Regular app launch:

Any idea how to fix it? same problem here…

Sent the bug report, they are currently working on it. Had a chat with the support guy 3 days ago, he clarified device specs, so there is a hope they will fix it in further updates.

which version of Unity do you use? i was thinking to try to update unity and rebuild game from 2022 version