Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.18
more ▼

asked Apr 05 '18 at 07:00 AM in Using UE4

avatar image

21 2 4 5

avatar image hdelattre Apr 11 '18 at 02:57 AM

I've spent a long time debugging this issue and I have some comments that will hopefully help the Epic devs:

This occurs in a freshly created VR template in 4.18 and 4.19 (I haven't tried an earlier version).I am using an Oculus, I am not sure if this issue is present on the Vive. This issue is not present when using a non-VR PIE mode.

To reproduce add a OpenLevel node to the playercontroller on a keypress to have it open another level from the start level. Start the game in a VR preview and press the key to open the next level. When the load has finished close the PIE VR preview and start it again and repeat the process. The second time (and all subsequent times until the editor is restarted) the load will hang for a very long time and the HMD screen will freeze with a timer icon over it (different from fading to black during a normal load).

The hang is always exactly 30 or 60 seconds (+ 1 or 2 for normal load delays), suggesting to me there's some hangup that's only resolved when the garbage collector first kicks in. It seems the game thread is being blocked by the rendering thread which is being blocked from flushing some cached resources from the previous run.

I have one project pretty far into development that does not have this issue unlike other projects. I'm still trying to work out why it's not present in that project. Here is a stat profile file for the profiler loading from one empty level into another (to isolate the issue) that demonstrates this problem (just find the 30000ms spike in the middle!).

avatar image hdelattre Apr 11 '18 at 02:57 AM

Relevant stack trace:

     GameThreadWaitForTask (in RenderingThread.cpp)
     UObject::SetLinker(FLinkerLoad * LinkerLoad, int LinkerIndex, bool bShouldDetachExisting)
     FLinkerLoad::FindExistingExport(int ExportIndex)
     FLinkerLoad::FindExistingExport(int ExportIndex)
     FLinkerLoad::Tick(float InTimeLimit, bool bInUseTimeLimit, bool bInUseFullTimeLimit)
avatar image sampattuzzi Jun 05 '18 at 05:45 PM

Even simpler repro steps:

  1. Create a minimal C++ project

  2. Include HeadMountedDisplay in the PublicDependencyModuleNames.

  3. Open a level with UGameplayStatics::OpenLevel() or blueprint.

This is still an issue in 4.19.2.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

 if (bShouldDetachExisting)

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.

more ▼

answered Apr 11 '18 at 06:50 AM

avatar image

76 1 6 10

avatar image dubako May 14 '18 at 11:55 PM

hey wow that worked THANKS!!!!

avatar image Jmusule May 18 '18 at 12:54 AM

Wow, thanks a lot! I was having exactly the same issue, this worked perfectly!

avatar image Ategig Sep 25 '18 at 03:36 AM

Thanks for this fix, it's really helpful.

avatar image DizzyDerF 5 days ago

Necro-Post, thanks a lot @hdelattre, this was the fix I needed. I've seen this in the past but it went away with updates. Now with the latest Oculus 4.22.3 it seems to be back but this fix worked!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Thanks a lot for the fix!

more ▼

answered May 29 '18 at 02:46 PM

avatar image


(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question