Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

The weird iOS8 + Unity3D hiccup

Discussion in 'iOS and tvOS' started by marcus-qiiwi, Oct 10, 2014.

  1. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    we've ran into a strange problem when using Unity3D and iOS8. After about 1 minut there is a large (sometime a bit smaller) hiccup and we can't figure out why... Garbage collection?

    We spent a few days trying to find out what the problem was and then created a minimalistic demo project where the exact same problem occurs.

    The hiccup does not appear on iOS 7 or lower devices, not on Android and not in the editor. Only iOS8. We've tried build both with the lastest release of Unity and the latest 4.6 beta.

    Does anyone have a suggestion on how to fix this? Is it a bug in Unity3D?

    Demo project:

    - Click the "Black bar" in the first scene to get to scene two where the problem occurs.
    - Look closely at the casinos. After about 1 minute you will see that they stop for a moment and then jump forward. As if a few frames were missed.
    - The problem does not seem to appear if we go straight to "scenetwo" from launch.

    https://github.com/dale/demoproject-hiccup

    Thanks!
     
  2. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    4.6 Feels really unstable to me also, I think you should use profiler to figure out the issue.
    I see hiccup in my project which is related to 4.6 uGUI
     
  4. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    The issue appears in 4.5 as well. The profiler reports different stuff every time unfortunately...
     
  5. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I understand, but the profiler reporting different results each time is very odd..
    Maybe take a screenshot of profiler window
     
  6. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Okay, I will collect some screenshots of the spikes.

    Can you repeat the issue in the demo project i attached?
     
  7. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Yes I just tried it now on 4.6b20 and its working okay, not seeing any Hiccups as you mention.
    Using Mac machine, not sure dude - good luck
     
  8. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Just to be clear,

    You tested on an actual ios8 device? The hiccup does not occur in the editor.
     
  9. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Ah ok, not tested it on device, just in editor.

    This is what you need to do then, change project to iOS then make sure in Build settings, development build is ticked and also the profiler tickbox, build within xcode and make sure your phone is attached to computer, keep unity open with the profiler, then within profiler there be a drop menu to select the phone, this should give you more accurate results.
     
  10. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Thank you for your answer, we´ve done that, but the problem is that the Unity profiler is showing different reasons every time, just random. Sometimes it´s the camera renderer, sometimes physics, sometimes graphics. But always at the same time, 1 minute after launching the app and switching to scene 2, and it only happens on iOS8 devices. We have built a more complex app that had this behavior, but made this test project to isolate the problem and now we have boiled it down to only a camera, a few objects with sprites and one script moving the camera, the problem seems to be iOS8 + Unity.

    I attach some pictures from profiling
     

    Attached Files:

    Last edited: Oct 13, 2014
  11. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    In my game the second biggest resource taker is "Graphics.PresentandSync" on Iphone4 after something called "Overhead", I spent many hours googling and forum searching with no luck.
    Therefore I wait for Beta 21 as I think using this Beta 20 is poor performance and slightly bugged.
    Beta 21 will contain 4.5.5 changes which I been waiting for.
    Lets see what happens.
     
  12. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Yepp, we've seen the same problem in the current 4.5.5 unfortunately... No other ideas?
     
  13. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,850
    We got other reports on this issue. It seems to be caused by new "feature" of iOS8, where is watchdog is generating exception report if your app is shuffling threads too often. We are looking into ways how to mitigate/avoid these reports.
     
  14. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Okay, how can we follow up on this so we know when there is a fix avaliable?
     
  15. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Any news on this?
     
  16. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,850
    It was reported as a bug to Apple, so far we haven't received their feedback.
     
  17. marcus-qiiwi

    marcus-qiiwi

    Joined:
    Jul 29, 2013
    Posts:
    19
    Any news now?
     
  18. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,850
    They are still investigating issue on their side.
     
  19. CyberTurboPlays

    CyberTurboPlays

    Joined:
    Nov 7, 2014
    Posts:
    65
    i think i might have same problem in my current game, or worse. i m using nGui for my entire game, draw calls are keeping in one digit number the whole time. When play in editor, flawless. when play on android or iPad, some irregular hipcups, and especially on ipad with IOS8.1.1, some animation seems to be like on 12fps or something, like ghosting effect, disgusting!
     
  20. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    Hello,

    In my case the hiccup is caused by a crashreport. The app itself just runs rock stable while the report is written in the background. :D

    Here is an snippet of the report:

    Exception Type: EXC_RESOURCE
    Exception Subtype: WAKEUPS
    Exception Message: (Limit 150/sec) Observed 385/sec over 300 secs
    Triggered by Thread: 0

    It only happens on IOS 8 devices. I don't use any self made multithreading inside my game-project. It always happens after playing the game for 3 minutes. I suspect that Apple will refuse my next update of the game because it happens always after a fresh start of the game. I also filed a bug report ((Case 654139) -e 1) Application has after 3 minutes play a major hiccup).

    The compleet logfile is attached to this message.



    Greetings,



    Peter.
     

    Attached Files:

  21. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    52
    Oh man, I have the exact same problem. It's the crash report for sure:

    Exception Type: EXC_RESOURCE
    Exception Subtype: WAKEUPS
    Exception Message: (Limit 150/sec) Observed 422/sec over 300 secs

    I submitted the bug two times already and no response so far.
     
  22. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
  23. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
  24. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    699
    it's not a fix, it's a workaround at best; Apple has to fix it, I wouldn't install separate mach exception handler and *discard* all the exceptions in Unity and on iOS8 only
     
    Last edited: Dec 12, 2014
  25. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,443
    Just experienced this one as well. Mantas, is there someone or a mailbox that devolopers can also reach out to at apple to try an escalate this?
     
  26. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    If its a Apple issue I wonder if they fixed it in 8.2 betas, or its a xcode thing?
     
  27. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    699
    Well, upon further reading seems I got it wrong at the first glance, looks like Apple changed hard limits in iOS 8+ as to how often can be sleep/wake cycle run on each thread - so it's hard to say who should be fixing what ;)
    It might be related to audio and energy efficiency of an app, but I would have to watch some wwdc video/s to be sure :%
    I wouldn't count on that it is fixed/adjusted in whatever iOS beta
     
  28. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    I Agree that this workaround should not be a permanent fix.

    In my case I worked for 320 hours on an update and I can't publish it anymore.

    The number of wakeup calls seems related to the number of meshes/textures that I have inside my game. It would be great if Unity could tell us a temporary workaround (or do I already need to migrate to Unity 5 for this game)?

    Greetings,


    Peter.
     
    Last edited: Dec 15, 2014
  29. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    Unity 5b16 has the same problem. I will create a bug report for Unity 5 too.


    Peter.
     
    r618 likes this.
  30. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,850
    Submitting radars to https://bugreport.apple.com often helps, especially mentioning it's a regression.

    P.S. we still haven't heard much back from them on this issue :/
     
  31. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    It can help if someone posts on Apple developer forums, maybe more visibility, as for as general public mailbox,they probably get 100 spam messages a day, doubt they will reply, I remain hopefull...
     
  32. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    200
    So is this confirmed to be an iOS 8 issue? We've been running into "Graphics.PresentAndSync" with the child "Device.Present" causing a lag spike in an extremely simple game. The only transparency on the whole game is one tiny cube with a transparent shader and two arrows using NGUI.
    My testers have all reported the issue, but I never ran into it because my main test device was an iOS 6 device (for my low-end)

    Here is a shot of the profiler using an iOS 8 device.
     

    Attached Files:

  33. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    52
    You can't rely on Profiler in this case, it will show different result every time.
     
  34. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    I filed a bug to Apple. case number:

    19266618

    I also included a link to this topic. Lets hope that they have a clever solution. ;)


    Peter.
     
  35. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    200
    Why can't I rely on the profiler? I have development build connected. I play the game. The moment I see a lag spike that isn't expected (I ignore level load spikes. I only look for mid-gameplay spikes), I push the home button on my phone, which also pauses the profiler. The spike on the FPS on the profiler coincides with the spike on my device. I go to that frame, and look at what caused it. And it's consistently the same thing.
    On my iOS 6 device, the spike never occurs. On my Android devices, no spikes. It's only on my iOS 8 devices (and the iOS 8 devices of my testers)
     
  36. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    52

    That's weird, in my case the result was not consistent, it showed the spike on whatever it stopped at the moment of hiccup. At first I noticed that the hiccup caused a spike in the disk write process, and then I found that my phone was writing a crash report, which in its turned caused the spike. More than often profiler just stopped recording after the hiccup.
     
  37. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    This behaviour also happens inside the profiler if it needs to stay in touch with an out of sync measuring. Lets make an assumption and say the IOS device was hanging in your Unity Game Sandbox for a certain time while writing a bug report over it (freezing it). Then the process "Graphics.PresentAndSync" gets no input and just spikes the profiler readings.

    Is your device also creating a bug report around the same time as the spike occurs? In my case the report is only generated while xcode is disconnected from the device.


    Peter.
     
    Last edited: Dec 17, 2014
  38. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    From my point of view the profiler is not build for this kind of failures. It's more made to find slow impact things inside the "Unity Editor World" on wel performant hardware. After the big hitches are gone you proceed to the mobile device.

    Peter.
     
    Last edited: Dec 17, 2014
  39. dsi76

    dsi76

    Joined:
    Jan 4, 2015
    Posts:
    1
    Has this problem been resolved? Did Apple respond? Reason I'm asking is that I am also seeing the same issue in Corona SDK.
     
  40. matiasjaure

    matiasjaure

    Joined:
    May 27, 2011
    Posts:
    37
    I am using Unity5b11 and experiencing this. Which version is safe to rebuild ? 4.5 ?
     
  41. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    52
    It's not in Unity, it's in iOS8+
     
  42. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    243
    Hello,

    I spent some more time on this issue. I builded a scene with a non-moving camera that is looking at a cube (taken from the hiccup master project above). Deployed it on an iphone 4s. My results where that the crash log always is generated. It just takes some more time before it will happen. In my case around 8 minutes which can conclude there is some queue or array getting bigger and bigger to execute (or should I say awake).

    I also send a mail message through iTunes Connect and asked the following question:

    My app is generating with IOS8 a crashreport. The app itself is running fine. It happens with every fresh start of the app. I also created a bug report on: https://bugreport.apple.com I don't see any unusual memory or cpu consumption. Als no memory leaks. Will my next update be rejected?

    Peter.
     
    Last edited: Jan 26, 2015
  43. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,850
    This hiccup, which happens when exception report is generated, should not be reason for rejection.
    If that's happens to you please let us know and supply your app bundle id.
    Thanks!
     
  44. snlehton

    snlehton

    Joined:
    Jun 11, 2010
    Posts:
    95
    The reason why you see the hickup in random places in the Unity profiler is that the profiler is only measuring single thread/context/whatever, and the stall in another thread/process will then show up in whatever place the profiler was profiling.

    I've been chasing these same kind of issues in the past and it drove me nuts, until I realized that it wasn't Unity that caused the hickup. In my case it was iPad Mini running low on memory. Not low enough to generate the low memory warnings, but I guess the memory was fragmented or something, because booting always helped. And also reducing the texture sizes...

    I would see the hickup in places like evaluating animations, calculating physics, rendering, scripts... It would be great if the profiler could somehow make a separation between Unity process and external process CPU time... :)
     
  45. Steve.s

    Steve.s

    Joined:
    Feb 9, 2015
    Posts:
    1
    Well... Something has to happen.
    We bought Unity for a total of 4500$ and we put over 6 months to a project - made with Unity.
    At the same time we were supposed to launch the game IOS8 was realesed and this Hiccup really destroyed the game. This was never a problem until then. We´ve been waiting for a fix for over 7 months and nothing happens. For now the 4500$ is a complete waste and the 6 months put into the project is even worse. After putting days of trying to find the problem with the profiler and optimizing we boiled it down to a IOS8 + Unity problem. Even happens with 2 almost completely empty scenes in a completely new project. There is nothing we can do to fix it.

    So no, its not an IOS8 problem, neither an Unity problem. Its an (Unity + IOS8)-problem, doesnt happen in Xcode projects, doesnt happen with Unity + Android -projects.

    Please get this fixed.....
     
    marcus-qiiwi and Revolter like this.
  46. maynoam

    maynoam

    Joined:
    Dec 24, 2014
    Posts:
    9
    Hi, how can I see if i'm having this same issue? Where do I get indication of the crash report? Would i see it when downloading the devices crash reports in the x-code devices window?
    Thanks
     
  47. maynoam

    maynoam

    Joined:
    Dec 24, 2014
    Posts:
    9
    Never mind I see them now, apparently I reached a limit on the amount of reports and the new ones weren't being written (though the hiccup still happened)

    Can someone confirm if:
    - The workaround works, and if so is it stable? Has anyone submitted a game using it?
    - Does the issue exist in the latest iOS beta release?

    Thanks
     
  48. maynoam

    maynoam

    Joined:
    Dec 24, 2014
    Posts:
    9
    Clearly this issue does not effect all unity games, otherwise we would see much more noise around this. I for one frequently play games, at least one of which I know is developed in Unity (Crossy Road) and the only exception reports I see are coming from my game.
    On the other hand from the posts in this forum, even the simplest projects generate this exception, so what are we missing? There must be something these other games are doing/setting which avoids this issue.
     
  49. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    They dont have this issue as they are pouring loads of money into all kinds of sophisticated tech/advanced programming/hacks that it be hard for any indie developer to do..dude game studios with loads of money to spend can do anything! Money talks in the game industry, anyway do not wish to go offtopic.

    The major spikes I see all over the place is Dyamic font usuage, never really understand this. As for the hiccup I get it mostly on Ipad Mini, thing is other users cannot really report as most ppl give up and think F*** it, its to do with some coding issue and cant fix so just release. I spent days trying to resolve issues with builds only find it was Unity issue, I just hope this not happen in Unity 5 and we on RC1

    Someone should really check Unity 5 rc1?
     
  50. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    52
    I've tested and can confirm that this issue appears at least on these devices: iPhone 4S, iPad 3, iPhone 6