Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Loading.UpdatePreloading taking up precious time for no reason

Discussion in 'Editor & General Support' started by Antony-Blackett, Jun 19, 2014.

  1. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Is this normal?

    Screen Shot 2014-06-19 at 5.44.13 pm.png

    As you can see it takes up 1.5 milliseconds per frame and occasionally spikes to 3-6 milliseconds.

    I'm wondering if this is normal? Has anyone come across this before? I've never noticed it when profiling my other games. I'm not loading things every frame and I've even gone so far as to remove all Resources.Load calls from my game to ensure I wasn't.

    Does anyone who why this might be happening?
     
  2. iMacWang

    iMacWang

    Joined:
    Jul 3, 2014
    Posts:
    3
    [QUOTE =“安东尼布莱克特,后:1668664,会员:35561”]这是正常的吗?

    [ATTACH =全] 104535 [/ ATTACH]

    正如你可以看到它占据了每帧1.5毫秒,偶尔尖峰3-6毫秒。

    我想知道如果这是正常的吗?有没有人遇到过了吗?分析我的其他游戏的时候我从来没有注意到这一点。我不是装东西的每一帧,我什至走了这么远,删除我的游戏所有Resources.Load调用,以确保我没有。

    有谁谁,为什么会这样?[/ QUOTE]

    我也有同样的疑问? Loading.UpdatePreloading有什么作用? 以及Application.LoadLevelAsymc in Background的工作原理
     
  3. ErwanB

    ErwanB

    Joined:
    Nov 14, 2012
    Posts:
    25
    Definitely not.
    The same occurs with an empty project using Unity 4.5.
    Calls to Loading.UpdatePreloading > Application.Integrate Assets in Background did occur in previous versions but cost was insignificant.

    I have this problem on iOS builds, sometimes this is taking up to 70% of my frame time so quite a huge deal.
    An issue has been opened, please vote so it will hopefully get fixed in the next minor version:
    http://issuetracker.unity3d.com/iss...nd-has-greatly-increased-call-time-in-4-dot-5
     
    waglchn likes this.
  4. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Yay I'm not crazy! Thanks. I've up voted the issue. Have you submit a bug through the bug submission tool? I find Unity are pretty good and fixing bugs I submit with simple reproduction projects attached.
     
  5. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    612928 is with devs for fixing. The issue tracker link earlier in the thread represents a bug posted by a high profile game development company, so I suspect this issue is high on a list for fixing.
     
  6. ErwanB

    ErwanB

    Joined:
    Nov 14, 2012
    Posts:
    25
    Great news ! Now we just have to wait for unity devs to perform their magic :)
    Thanks for the update Graham !
     
  7. ErwanB

    ErwanB

    Joined:
    Nov 14, 2012
    Posts:
    25
  8. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Yeah, I does seem ridiculous to spend a ~10% of a frame time on something I have never needed to do before... It's also strange that issue was marked as a Regression bug but also as By Design... seems like an oxymoron.
     
  9. Gavin-Park

    Gavin-Park

    Joined:
    Dec 16, 2013
    Posts:
    2
    If it can be improved "By Design", can anyone let me know how? Even with a extremely simple scene with some GUIs only, updatepreloading makes significant performance hit. On iOS 8.x, this seems to be really issue. So anyone?
     
  10. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    There is a new issue opened :
    616918

    The problem persist on version 4.5.5
     
  11. woko

    woko

    Joined:
    Oct 11, 2011
    Posts:
    23
    I too am seing this issues, retina iPad mini ios 8, ~1.18ms per frame
     
  12. DaGround

    DaGround

    Joined:
    May 26, 2014
    Posts:
    16
    well i dont have unity pro with a profiler but i have serious performance issues with the new version.

    if i create a new project with an empty scene and just run it, i'm at 13-15ms!! it used to be around 0.1 ms.

    My existing upgraded projects doent seem to have this issue unless i am creating a new terrain..

    and i was so looking forward for oculus programming with the dk2 and the free plugin but i cant get stable framerates with that problem :(

    (specs: i7 2600k & r9 290)
     
  13. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    15 ms sounds like it's vsnycing so it's waiting for the frame, essentially it's wasting the excess time. Turn off vSync and try it again. Note that vsync cannot be turned off on iPhones so you'll never get faster than 60 fps

    As for my initial post... this is still happening. Any updates Unity? I don't want 10% of my frame gone to something that's totally not doing anything.

    Thanks in advance.
     
  14. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Did this ever get fixed as using Unity 4.6.9 final and seeing lot of spikes on Android?
     
  15. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I haven't heard anything, I also haven't profiled it in a while to know if it's still happening.
     
  16. Astarorr

    Astarorr

    Joined:
    Jan 17, 2013
    Posts:
    41
    Have same issue with Loading.UpdatePreloading on 5.3.1. On Corei7 4790 it takes 14ms per frame, reducing framerate to 60FPS. On Lumia 640 it reducing FPS from stable 50-55 to 8 FPS.
     
  17. BongoMongo

    BongoMongo

    Joined:
    Dec 12, 2013
    Posts:
    7
    Same here with on iOS using Unity 5.3.1p1. Seeing spikes up to 700ms in the profiler
     
  18. Aram-Azhari

    Aram-Azhari

    Joined:
    Nov 18, 2009
    Posts:
    142
    Having similar issues on Android on latest Unity 5.3.x as well as 5.2.x. In our case the
    Loading.UpdatePreloading -> Application.Integrate Assets in Background -> Loading.LockPersistentManager takes 2218ms!!!!!
     
    leni8ec likes this.
  19. TamaHobbit

    TamaHobbit

    Joined:
    May 18, 2014
    Posts:
    10
    This is still a problem, but I guess we can't open another issue since it has already been closed.
     
  20. MrRightclick

    MrRightclick

    Joined:
    Nov 14, 2012
    Posts:
    19
    Sorry for possibly necroposting, but our project also had a huge problem with SceneManager.LoadScene() causing long (10-15 second) loading times on mobile during the first reload of a scene (pressing the Restart button the first time during a scene), and the profiler showed Loading.UpdatePreloading taking up 98% total. After the first restart the load times were back to 1-2 seconds, but this sudden spike and wait time was really troublesome for our testers.

    We had to revert back to using Application.LoadLevel for now. This reduced the Loading.UpdatePreloading spikes to 45-58% and loading times back down to the usual 1-2 seconds.

    We are running on Unity 5.3.2f1 Personal, so not the latest available version.
     
    KuRouZu and MrEsquire like this.
  21. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Your issue sounds different to the one we were talking about. Your issues appears to be when you are actually loading something. We were suffering a performance hit from UpdatePreLoading when we weren't even loading anything and in my case I never even used async loading.
     
    Last edited: Apr 5, 2016
  22. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    308
    Have the same issue here using 5.3.4. Never once have i used async loading, nor am I ever attempting to load things on the fly. Quite troubling as it took 295ms according to the profiler.
     
  23. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    GAFs will also do this, if any of you are using those. I cut out all my GAF animations, created a single mesh for each state and frame of the gaf at the beginning of the game, and have my own "Non-GAF animation" use shared meshes that read from those universal meshes when needed. That fixed it for me completely.
     
  24. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    what is a GAF animation?
     
  25. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    GAFMedia.com. Converts swfs to Unity format for 2d games. Ambitious but buggy.
     
  26. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    Hit spike for 105737.37 ms in Unity 5.5.4p1 (latest in 5.5.*). Almost two minutes freeze! Any fixes for that?
     
  27. Dabartos

    Dabartos

    Joined:
    May 26, 2016
    Posts:
    33
    1/07/2017

    upload_2017-7-1_19-6-40.png
     
  28. Killersan

    Killersan

    Joined:
    May 27, 2014
    Posts:
    76
    Got exactly same issue as Esteem, 200ms spikes with same profile hierarchy.
    I found out that it was caused by this function Resources.UnloadUnusedAssets()
     

    Attached Files:

  29. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Just started happening for us after updating to 2017.1. Takes about 20 seconds to load the next scene on the first scene load. Doesn't appear to be helping anything... just causing a needless delay. And it's sporadic. Happens about 60% of the time.
     
  30. MysticRice

    MysticRice

    Joined:
    Jul 4, 2016
    Posts:
    2
    This recently was happening in my game, it would actually restart my entire game. Deleting the code i had that restarted the level worked, so maby it lies in a scenemanager.code ? sorry iam new to unity; just had ran through the same problem , found myself in this thread, fixed it and was hoping that what i found might help you all.
     
  31. milgrade

    milgrade

    Joined:
    Aug 7, 2017
    Posts:
    1
    @Killersan may be onto something; I commented out some lines of Resources.UnloadAsset within OnDestroy from an inherited class and that dropped the Profiler counts way down.

    So maybe this has something to do with unloading resources. Just started happening to me after upgrading to Unity 2017.1.1f1 and DEV_Unity_2017.2.0 of the Mixed Reality Toolkit.
     
  32. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    I am also having a problem with this as well. 66% taken up by this function.
     
  33. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    I am having this issue as well and it is causing my scene to stutter like once a second or so. It is using 91 - 93%....

    https://i.imgur.com/kd9AgPJ.png

    Edit, nevermind. Turns out it was a new asset I installed. They have since issued a patch.
     
    Last edited: Jan 25, 2018
  34. jAchtzehn

    jAchtzehn

    Joined:
    Dec 17, 2015
    Posts:
    6
    I am having the same issures, could you (MostHated) please tell us which asset it was?
     
  35. ImperativeGames

    ImperativeGames

    Joined:
    Dec 11, 2016
    Posts:
    34
    Does anyone has a solution? 100ms spike every second for one method (GC.MarkDependencies) is quite lethal for my game.
     
    waglchn likes this.
  36. masoudarvishian

    masoudarvishian

    Joined:
    Jan 15, 2015
    Posts:
    9
    I am having the same problem -> Unity 2017.3.0f3
     
  37. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    ok 2018.2.0f2 happening randomly.

    On start cpu is like 80ms :\ open profiler and saw it but it was totally pre freez and finally freezed.

    Ir player dyes and respawn issue seemed gon once...
     
  38. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    same here.
     
  39. Felipeota

    Felipeota

    Joined:
    May 30, 2013
    Posts:
    7
    This is happening to us as well. I looked for UnloadUnusedAssets as @Killersan mentioned and found that the I2 locatlization plugin was calling it. Commenting it made the problem go away. But of course now I have to check what resources are left hanging on the I2 plugin because of that.
     
  40. DanTaylor

    DanTaylor

    Joined:
    Jul 6, 2013
    Posts:
    119
    Oh. My. God.
    This has been driving me mad from months.
    I too am using I2 localization.
    I commented out the UnloadUnusedAssets and the nasty 2 second freeze the first time a localised UI element appears is now gone.
    Thanks, @Felipeota!

    P.S. I2 Loc is pretty awesome apart from this, by the way.
     
    MGGDev likes this.