1
\$\begingroup\$

When I play my game made with Unity on iOS device, and press the home button or let the screen close by time or by pressing the power button and then try to come back to the game, the game freezes immediately. This does not happen always, only when there's certain things happened in the game in the current session. I have found nothing in common in between these situations. If those events have not happened in the current session, I can go to home screen and play other games and come back to the game and continue where I left without issues.

I have tried debugging on xcode, with no output whatsoever in the console regarding this issue. XCode reports 200mb memory usage and Unity profiler reports roughly 300mb memory usage when going to the pause state, and nothing happens when coming back to the game. We have had memory issues previously which we have been optimizing a lot lately, but this particular crash is still persisting. Android works fine, whaterver the device memory capacity is.

I have been trying to google for this type of iOS crash, with no luck. I'm asking here if someone might have some advice or direction for me to go to.

EDIT: I updated the question to match my current situation. I previously had some code in this question and talks about memory issues, which I have found out to have nothing to do with the problem at hand.

What happens according to the debug console in XCode:

  1. Home button is pressed
  2. OnApplicationPause(true) gets called
  3. One Update() gets called
  4. GameAnalytics detects a status change (headingToBackground event) and ends session
  5. User is at home screen, resuming game by tapping on the game icon
  6. GameAnalytics gets a headingToForeground event and restarts the session
  7. Nothing else happens after that

This makes me want to point my finger at GameAnalytics, but why it works sometimes, just not after these specific events?

\$\endgroup\$
3
  • \$\begingroup\$ 200MB memory usage... how much does the device have? If it were a 500 mb device, that could be iOS shutting it down. But that's not a freeze, it just suddenly stops. \$\endgroup\$
    – Almo
    Commented Mar 10, 2017 at 8:45
  • \$\begingroup\$ It's happening on all iOS devices with 1GB or less memory. I don't have any devices with 2GB memory at hand as our only 2GB devices are not at our studio right now. \$\endgroup\$
    – Lasse
    Commented Mar 10, 2017 at 8:47
  • \$\begingroup\$ It is also happening on iPad Air 2, which has 2GB of memory. \$\endgroup\$
    – Lasse
    Commented Mar 10, 2017 at 10:00

1 Answer 1

1
\$\begingroup\$

By disabling Facebook application event sending the problem went away, so it was Facebook SDK for Unity 7.9.0 that was causing the freeze.

Edit: That was for Unity 5.5.1f1. When building on Unity 5.5.2f1 Firebase 1.1.0 seems to be causing similar problems, while Facebook SDK 7.9.0 works fine.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .