Extremly long startup time on iOS

Problem:
My app has an extremly long loading time on iOS (30-40 seconds). I tested this on two iPhones (7 and 8). One time I installed the app through iTunes and the other time downloaded from the App store (‎Lucky Pirate - A Deck Builder on the App Store). The 30-40 seconds are spend on the launch screen and not the screen after (with the unity logo). That splash screen only lasts the 2 seconds which is the duration I set in the editor. To repeat, the launch screen shows for 30-40 seconds.

Why I think this is a bug:

  • On Android the app loads instantanously, no wait time, even on older devices.
  • On WebGL the app loads slower but still completes in 5-10 seconds not 30-40 seconds.
  • The Android app is 22 MB, the iOS IPA file is also only 32 MB large (no idea why the app store is showing 99 MB for the app size - maybe unpacked?).
  • There are no audio assets, only two large images (around 5MB each) and no other large assets listed in the build log.

What I tried to solve this issue:

  • Make sure I build a release version
  • I enabled “Use on-demand resources” in the editor
  • I switched from a launch screen with a static image to a storyboard → no improvement.
  • Tried Compression → did not work and make it even slower
  • Tried to use high stripping instead of low code stripping → did not help with the speed and cause bugs in my gameplay.

More info about my setup:

  • I am using the URP with a 2D game setup
  • I don’t have a Mac so I use Unity Cloud to build & publish the app
  • I am using Unity 2019.421f1
  • I have a few static classes that load the save file and send a request to the server to check for updates. I disabled the server check and the load time stayed. I haven’t removed the save file loading because that breaks my game, but the save file is 4 KB large.

I really appreciate your help because as of now the app is basically broken on iOS.

Update: I tried it on a third device, iPhone 7 and there is no launch time. It is as perfect as on Android, just starts without delay. Why is this happening on some devices but not on all??

1 Like

Since it is happening inside your game logic, it is very hard to tell with this little information. I recommend you just debug it with the profiler. You can connect an iOS development build to a windows machine, so you should be able to debug it even without a mac. Maybe you need to create a startup scene before your startup scene to connect to the profiler, before it is already running the process in question.

I tried but I couldn’t get it to connect. Is there a good guide that I can follow? I made a development build and I might have succeded in connecting visual studio, but what then? I don’t get a profiling view.

Anyway here is what I spend the rest of the day doing:
a) Tried a new empty project → fast, so it is something in my project.
b) Going back to my project and removing all my assets → slow
c) Removing all my code → still slow, so it’s not my code/assets.
d) Removing all plugins → surprise, surprise it is fast.

So it is one of the plugins causing the slowdown. I am now doing a bindary search to find out which plugin is the culprit. This is super tedious though as they are a lot of plugins and every build takes 30+ minutes.

// Edit
I narrowed it down to one of these:

"com.unity.visualeffectgraph": "7.5.3",
"com.unity.2d.pixel-perfect": "2.1.0",
    "com.unity.2d.psdimporter": "2.1.6",
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.spriteshape": "3.0.14",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.collab-proxy": "1.2.16",
    "com.unity.ide.rider": "1.1.4",

I suspect it’s the visualeffectgraph because it doesn’t support mobile. Anyway, I don’t need those packages and my launch time went down from 30 seconds to 1 second. So this is good enough for me and I spend hours building stuff so I am going to leave it here.

1 Like