Author Topic: Loading time: LoadLevelAdditive vs LoadLevel  (Read 5732 times)

hvilela

  • Guest
Loading time: LoadLevelAdditive vs LoadLevel
« on: October 14, 2012, 12:45:13 AM »
I asked this very same question at Unity Answers, I'm not sure if it's related to NGUI or not.

I'm facing a huge difference of loading time using LoadLevelAdditive (0.2s) vs LoadLevel (15s), even for empty levels. Sounds like the time is related to the last scene unload time. The problem is that the last scene is just a interface (created with NGUI) marked to be keeped with DontDestroyOnLoad. So why it would take that long?

Unity Answers question:http://answers.unity3d.com/questions/332114/loading-time-loadleveladditive-vs-loadlevel.html

hvilela

  • Guest
Re: Loading time: LoadLevelAdditive vs LoadLevel
« Reply #1 on: October 14, 2012, 02:26:46 AM »
I'm trying to isolate the problem and looks like NGUI (or the way I'm using NGUI) is the cause. I'm keeping my interface (DontDestroyOnLoad) and loading a new (simple) level.
Unity calls OnEnable for every objects that was kept from the last level. Could be this method call in all NGUI widgets be the cause for so huge CPU spike?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Loading time: LoadLevelAdditive vs LoadLevel
« Reply #2 on: October 14, 2012, 04:51:01 AM »
Off the top of my head I can't tell you what's happening. Enabling widgets is harmless -- UIWidget.OnEnable simply sets a local flag indicating that the widget has changed and needs to find its panel again. It doesn't do anything beyond that.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Loading time: LoadLevelAdditive vs LoadLevel
« Reply #3 on: October 14, 2012, 05:18:41 PM »
Could simply be scene overhead by unity. Try going from an (almost) empty scene to another empty scene, see if the same thing happens.

I mean without NGUI or anything other than some sort of debug button to change the scene.