I’m facing an issue on iOS devices after performing CPU optimizations for mobile. While profiling the game, I occasionally notice a few spikes occurring consecutively. Upon inspecting the details of these spikes, I found they are caused by WaitForTargetFPS, which I believe is related to VSync.
I had already disabled VSync in the Quality Settings, but I recall hearing that iOS devices might ignore this setting. I’m unsure whether this information is accurate. Additionally, I’ve set the target frame rate to 60 using Application.targetFrameRate.
At this point, I’m not sure how to resolve the issue. I’d greatly appreciate any suggestions on optimizing the game further.
Note: I’ve been testing the game on an iPhone 8, as my primary target is to optimize for low-end devices.
Profiler screenshots are attached below for reference.
You should also profile on the device, the editor won’t give you the proper vsync-related behavior.
But this generally means the CPU is waiting for the GPU to finish work. If you’re optimizing the CPU performance, this is good to see, because it means you’re now GPU-bound. This is not a spike in the traditional sense, where suddenly a lot of CPU work is performed and stalls the game, this instead means the CPU is idle during this time.
Android and iOS: The vSyncCount field is always ignored because mobile devices do not allow unsynchronized rendering. Use the Application.targetFrameRate field instead to control the frame rate.