Huge Lag / Hiccup / Delay with LoadLevel, LoadLevelAdditive

Hi guys,

I searched every inch in here reading through related topics but cannot find a solution to my problem, that is:
Loading new levels/scenes with LoadLevel or LoadLevelAdditive gives me a huge hiccup at level start up, actually it seems to cut off the first 3 seconds (approximately).

Exactly these same levels start up perfectly without any hiccups when loaded as the first level in the game.

I emphasize: I don’t have trouble with loading times (these are 3 to 6 seconds depending on device), it’s the hiccup that annoys me and f**ks my gameplay as I have a 3 second countdown on level start that is completely cut off.

I tried different approaches with “loading screens” (tiny levels) and yields but cannot get rid of the hiccup. I’m stucked. Does anyone has an idea what’s happening here and how to approach it?

sounds like you are just overdoing the memory usage and thus its forced to unload stuff from ram in parallel instead doing it one after the other.

also ensure to stop all audioclips you have running before loading levels.

aaaand: ensure to have a loading screen cause at the start of a scene, the textures must be uploaded to the graphics memory, during this times you get heavy stutter. you should not start gameplay at all before this is settled (this is a hardware thing and present on any platform aside of perhaps the ps3 and x360. even pc has this)

@dreamora
Hey man, you never sleep :-), thanks for your answer!

You mean destroyed and garbage collected? Or is there anything else that I’m not aware of?

I don’t have any audio at the moment.

I approached it by having a tiny scene in between levels loading (additively) the necessary next level. So the “unload stuff from ram in parallel” should not happen as the previous level is already destroyed because of the tiny scene. Your idea is having a loading screen as part of the loaded level occluding the hiccup? Right? So my problem seems to be my gameplay starting immediately. Concluding: I have to hack gameplay to delay. Weird, Unity can handle any of my scenes perfectly when loaded as the very first scene but needs a workaround for delaying gameplay with the next loaded scenes. But wait, I have another suspect. I will check this and get back.

The suspect I had in mind, doesn’t cause the problem. So my workaround for now is using OnLevelWasLoaded() with a “yield WaitForSeconds” to delay gameplay, btw OnLevelWasLoaded doesn’t work with LoadLevelAdditive() but with LoadLevel() it does.

Still I think this matter should be handled by Unity more properly as it’s already possible to play the very first loaded scene correctly without any hiccups. Kind of annoying to work around this problem, and might be tricky for some gameplays. Looking through the forum I see many devs having trouble with loading screens or preloaders or related scenarios. No matter what hardware I think this can be handled better. As LoadLevelAsync does work only with Pro, this means that there will be a bunch of stuttering games outthere with a Unity splash screen at startup :wink: