open level taking a really long time (strange)
I am having a weird issue. i have a vr project using the vr expansion plugin.
when i open the project, i hit vr preview and everything works fine, i use a button press to re open the level i am currently on and everything works fine BUT ONLY THE FIRST TIME I HIT VR PREVIEW. every time after that, the level takes forever to re-open. if i close and reopen the project , same thing. the first time i use vr preview everything works as it should and i can restart the level as many times as i want and it opens very quickly. , but after that it freezes up or lags for a long time before reopening the level. what could possibly be going on?
asked Apr 05 '18 at 07:00 AM in Using UE4
Temporary workaround fix:
To fix the issue you have you call ShowSplashScreen before you call OpenLevel. Make sure your GameInstance calls SetSplashScreen (and get some nice splash screen texture to use). You'll probably just do this in its Init function. You can also call EnableAutoLoadingSplashScreen for convenience, but the auto splash screen won't be enough to fix it on its own because it will turn on too late. Then you'll need to call HideSplashScreen once the level has loaded (in my case I do it once the local player has possessed a pawn in the level). Make sure you don't ever miss the HideSplashScreen call or you can end up in a situation where the player just sees the loading splash screen indefinitely.
Debug Info (Please also see my initial comments under the OP):
I figured out why my project didn't have the issue. If you have a VR loading splash screen enabled when you start loading the level it'll prevent the hang from happening. I believe this is because the bug is due to something the HMD is rendering not being unloaded properly when the next map starts loading which locks up the rendering thread (which locks up the game thread in GameThreadWaitForTask) until the GC finally removes the object causing the block (obviously this explanation is missing a lot of technical detail since I haven't looked at the HMD rendering code but hopefully I'm in the right ballpark). Also, the issue is present in 4.18 but seems relatively new anyway so I'm wondering if there was some recent change in the Rift's drivers that made this issue pop up suddenly. Just a random guess, it would be helpful to know if you are using a Rift too.
Note that this bug occurs even if you're loading an empty pawn into an empty map and it only occurs in a VR preview in editor due to this code in UObject::SetLinker
The UObject is a Texture in this case and PostLinkerChange triggers ReleaseResource on it and that release seems to be where the block is.
I'm guessing this fixes the issue because it stops rendering everything but the splash screen texture, so whatever resource or process would otherwise lock up the rendering thread during loading was already hidden/stopped by the splash screen. I hope this is helpful and hopefully Epic will weigh in soon.
Follow this question
Once you sign in you will be able to subscribe for any updates here