- Home /
The question is answered, right answer was accepted
Unity app crashes on iOS on startup
Hello Comunity,
I have been developing mobile apps for over a year now. The apps are fairly simple, having only one scene where I move through the menus and instantiate levels etc. I've had no issues until now.
I am working on a slightly more complicated 2d shooter. The number of assets and prefabs has increased considerably. The thing is when the game starts there is nothing loaded in the scene. There is only the main menu active on the canvas and an empty scene in the background. However, the game crashes immediately after the splashscreen. I am sure it is because the project has grown big because on an earlier build, where I had a smaller number of prefabs, the game took a lot to load on iphone 5, but it worked. In the meantime, i've added new character assets, including 2d textures and created new prefabs in the project view and now it crashes immediately.
I checked the code, nothing is different that what i've been doing on other games. The message i get in xcode is this:
OPENGL LOG: Creating OpenGL ES 2.0 graphics device ; Context level ; Context handle 358101232 Initialize engine version: 2018.2.1f1 (1a9968d9f99c) WARNING -> applicationDidReceiveMemoryWarning() Message from debugger: Terminated due to memory issue.
What I don't understand is why is memory being used in excess if nothing is loaded in the scene. Do assets in the Resources folder use up memory although they are not being used actively in the game?
Should I use separate scenes? For the main menu, for each stage etc.?
What can I do to fix this memory crash issue?
Thanks in advance, Alex
Answer by AlexVlad · Nov 14, 2018 at 08:51 AM
OK, so yeah, for anyone having the same problem, i figured it out. Shame on me for not thinking of this. If there are references in your script to assets, like public variables assigned in the inspector then yes, they do occupy memory space, even though they are not yet in the scene.
I opted to load them from resources and decided to use multiple scene just to be sure.
Cheers.
Hi , I'm also having this problem , I test my game on android devices usually (being 2020 , every android has over 3 gb ram) and everyting works fine , but for apple with 1,2 gb ram I get crash on loading big scene , how do you mean by using multiple scene ?
Follow this Question
Related Questions
iOS crash problem: Received memory warning . How to solve that? 1 Answer
Unity iOS 13 Memory leak Crash 3 Answers
App Store Rejection - Crashes 2 Answers
Unity 4.2 IOS Exception Handling 0 Answers
iOS game freezes on startup 0 Answers