Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Launching ANY Unity game makes Windows hang?

Discussion in 'Editor & General Support' started by ravenworks2, Feb 16, 2015.

  1. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Ever since I upgraded my video card, launching *anything* built with Unity causes very strange behaviour: the first Unity window doesn't appear until around 30 seconds after double-clicking the EXE, and during those 30 seconds, my *entire* computer—including cursor movement!—stalls to about 5 fps. It's so slow during this delay that I can sometimes watch individual windows redrawing piece by piece; folder windows occasionally go into 'stop responding' mode. Then, once Unity's first window appears, everything is instantly fine again.

    I'm running Windows 7 64-bit, with 6 GB of RAM. The problem started when I upgraded from a Radeon 6850 to a Geforce 970. I've already uninstalled the Radeon drivers and installed the Geforce drivers. I have an Oculus Rift, but this occurs even in non-Rift games, and even with the Rift disconnected.

    Has anyone else had this problem? Is there anything I can do to determine what on earth Windows is doing during those 30 seconds where it's so pegged that the cursor judders?
     
  2. Mabenan

    Mabenan

    Joined:
    Feb 7, 2014
    Posts:
    132
    Are there problems with other games or only with games made with unity.
     
  3. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    So far it has only happened with Unity games—although since yesterday, I have found a couple of Unity games that it *doesn't* happen with, so maybe it's only games compiled by a certain version of Unity...?

    For reference,

    Unity games that cause this lag:
    https://share.oculus.com/app/ocean-rift (VR)
    http://lilithzone.itch.io/lost-town (non-VR)
    http://caret-works.net/ggj/fancy_cat/FancyCat.html (Web)

    Unity games that don't cause this lag:
    https://share.oculus.com/app/alien-makeout-simulator (VR)
    http://kittyhorrorshow.itch.io/dust-city (non-VR)
    http://superhotgame.com/play-prototype (Web)

    I'm not sure if some common factor can be found (DX9 vs 11? Unity 4 vs 5?)

    And just in case it could be useful, a few examples of the non-Unity games I tested:

    Non-Unity games that don't cause this lag:
    http://digitalcybercherries.com/ (VR)
    http://www.goat-simulator.com/ (non-VR)
    http://madebyevan.com/webgl-water/ (Web)

    And as I mentioned, I haven't found a non-Unity game that can cause this lag, yet.
     
  4. Mabenan

    Mabenan

    Joined:
    Feb 7, 2014
    Posts:
    132
    have you ask the Developers if they can reproduce this problem.
     
  5. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    I'm not sure how that would help?

    I've been tempted to ask them for information about their projects to try and isolate a cause, but I'm not sure what criteria to ask for, does anyone have any suggestions?

    (And does really no-one else experience this minute-long stall while launching any of those projects?)
     
  6. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    It's not a widely-reported problem, no.

    Generally, support for games made in Unity needs to go via the developers of the games in question - we have no idea what crazy things they've done ;) - but if you want, you could try profiling your system (using a tool like Very Sleepy) to try and capture some information about what your CPU is doing during that massive lag.

    Your suggestions so far - D3D9 vs DX11 and Unity4 vs Unity5 - are good, so I'd look for the games' output_log.txt files for more information (should be in the 'Data' folder alongside the game executable). Other possible culprits include virus scanners (especially if Unity is taking 30secs to even show you the launcher window) and disk access.
     
  7. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Ahh, thank you so much for the log tip!!

    I can now confirm, that the lag ALWAYS happens in Unity DirectX11 projects, and NEVER happens in Unity DirectX9 projects!

    Interestingly, I tried Saints Row 3 (a non-Unity game) in both its DX9 and its DX11 mode, and the hang didn't happen in either case, so it DOES seem like this is Unity-specific.

    I've made VerySleepy logs of launching a Unity DX9 game and a Unity DX11 game (each only getting as far as the 'configuration' screen), but I'm not sure how to interpret them; I've attached them here in case they can help you make any sense of this. (The DX11 version does seem to have a new entry that took up a huge chunk of time, but I don't know what it is..)

    Thanks so much!!
     

    Attached Files:

    superpig likes this.
  8. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Sorry to bump the thread, but I feel like we were *so* close to fixing this, having narrowed it down to Unity DX11 projects…

    Does anyone have any suggestions for what could be making Unity lock up like this for an entire minute while trying to initialize its DX11 support?
     
  9. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Unfortunately the VerySleepy files don't tell me much beyond the fact that most of the time was spent in a function at address [75507E6C], which belonged to wow64.dll (part of Windows involved in running 32-bit applications on 64-bit Windows). It looks like it happened during loading of data, but it's hard to say for certain.

    I've built a minimal 32-bit D3D11 app for you - download it and give it a try.
     
  10. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Yep—even that tiny app triggered the hang!
     
  11. Mabenan

    Mabenan

    Joined:
    Feb 7, 2014
    Posts:
    132
    So when superpig analyse of the verysleepy file is correct a 64-bit D3D11 app shouldnt take so long.
     
  12. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Yes, trying out a minimal 64-bit Unity D3D11 project is the next step here. I've not got around to building the project though, with all the GDC prep, sorry...
     
  13. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Now that GDC is safely behind us, I figure it's safe to check back in here :)

    With Unity 5 being free, I was able to make myself a couple of test projects, and confirmed that a bare room (with a single cube) causes the hang when I compile it with DX11, and doesn't cause the hang when I compile it with DX9.

    So where do we go from here?
     
  14. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Were you testing 32bit or 64bit builds?
     
  15. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    I was trying 32-bit, but I just tried it again with 64-bit and got identical results.
     
  16. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Ah, interesting!

    Now that you have Unity installed, could you try the VerySleepy capture again, on 'Development Build' versions of both 32-bit and 64-bit players? Development Build players should include symbols that ought to make the VerySleepy files a bit more intelligible.
     
  17. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    You're right! The function it's spending a minute on is called "ChangeDisplaySettingsA". It's being called from "WinScreenSetup::InitializeResolutions". Does that give you anything to go on? (Should I attach the log?)
     
  18. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    So, ChangeDisplaySettings. We use it when we're building the list of resolutions that your graphics card supports, for testing whether a given resolution is actually supported. In pseudocode, we do something like this:

    Code (csharp):
    1.  
    2. for(each screen resolution returned by EnumDisplaySettings for the main display device)
    3. {
    4.    if(resolution is below 512x384, or has fewer than 16bpp)
    5.         skip resolution;
    6.  
    7.    if(ChangeDisplaySettings(resolution, CDS_TEST) != DISP_CHANGE_SUCCESSFUL)
    8.        skip resolution;
    9.  
    10.    otherwise add it to the list of supported resolutions
    11. }
    12.  
    We do something different in D3D9 mode - using the Direct3D9-specific API for retrieving the available resolutions - which is why you see this problem only with D3D11-based games and not D3D9-based games.

    So, why would ChangeDisplaySettings - in 'test' mode, so not actually changing resolution - be taking upwards of a minute? The only explanation I have - assuming that you don't have a gazillion resolutions and it's actually genuinely taking upwards of a minute to loop through them all, which I doubt - is that Windows and/or the display driver are taking a really long time to complete the test. Why are they taking a really long time? God (or Microsoft, or the display driver manufacturers) only knows...

    Trawling the web a bit, I see a couple of vague references to ChangeDisplaySettings having "a known compatibility issue" with Windows 7. I can't find any explanation of what this issue actually is, or whether it would result in the behaviour we're seeing here... but there is are notes on a workaround using a different API.

    I think the best next step here is probably going to be for me to cook up a little test app for you which tries out both APIs, and then we can see both a) that the ChangeDisplaySettings calls are indeed still the problem even when isolated, and b) whether the workaround approach has the same slow behaviour...
     
  19. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  20. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Oh, yikes, something must have gone wrong with the notification emails, I never got notified that you'd replied! Sorry!

    I have some more news, then—after your explanation about monitor resolutions, I've now confirmed that this bug ONLY happens while my Dell U3011 is connected! I use three monitors, but specifically unplugging the U3011 makes Unity launches go back to normal. (And despite what your pseudocode says about the main display device, setting a different monitor to be my primary isn't enough to avoid the bug...)

    Is there something I can run to get a list of all the reported resolutions for this monitor, so you can see if there's anything fishy about it?

    (Thanks again for all your help!)
     
  21. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Just a bump to find out what I should do to get you information about the monitor that causes this?
     
  22. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Hmm... actually I guess a first step with that monitor is to find out which driver it's using: is it just using a generic Windows monitor driver, or does it have a dedicated Dell-U3011-specific driver?
     
  23. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    The 'monitor type' shows up as "Dell U3011 (DP)", and when I click through into Properties -> Driver it says the Driver Provider is "Dell Inc."
     
  24. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    OK. I'm thinking that it's Dell's monitor driver which is responsible for this delay, so there's two things you could try out:

    1) Firstly, a potential fix: Check that you have the latest version of the driver. It says it's not been updated since June 2013 so the odds are you already do have the latest driver, but worth checking.

    2) If the fix doesn't work, a diagnostic test to confirm that it's Dell's driver: Tell Windows to use a generic monitor driver for that monitor, rather than Dell's custom one.

    Edit: also, even if you *do* have the latest version of the driver, it could be worth reinstalling the monitor driver anyway - considering that this started when you upgraded your video card, maybe the Dell drivers have some particular problem dealing with the fact that the card changed, and reinstalling the drivers could reset that.
     
  25. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    1) The driver is up to date.

    2) I did 'uninstall driver' and the problem persists.

    3) After rebooting, Windows automatically reinstalled the driver that I'd uninstalled, and the problem persists.
     
  26. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    Time for my monthly thread bump ;) What kind of information can I provide you about this driver?
     
  27. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    I'm having this issue too. Anything I build from Unity (even just a cube) is very slow to launch. The games ravenworks2 posted also have the issue, as does the test app from superpig. Playing in the editor is fine, and building is fine, but the startup time on the exe build takes forever. I'd estimate it takes anywhere from 15 - 30 seconds after clicking the exe for the resolution dialog to appear. During that time, the PC is completely unusable. The mouse moves at like 5fps and everything else is basically frozen (even the Windows performance monitor).

    From what I read in this thread, it seems related to multi-monitor and the Nvidia driver. I am also using triple monitors, the Asus Rog Swift PG278Q. All three are connected to an Nvidia GTX 980 via DisplayPort. I have tried turning Nvidia Surround on and off, no difference. I have disabled 2 of the monitors in the Nvidia panel, no difference. I have enabled and disabled G-Sync and SLI, no difference.

    Originally I had the monitor using the "Generic PnP" driver, but I updated to the Asus Win 8 64-bit driver, it's no help. I also have the latest Nvidia driver 353.06. I'm not sure what else I can do. This is a serious issue for me, please let me know if I can provide any details or if there is something I can try to fix this.

    Also, here is the Very Sleepy capture, which appears similar to ravenworks2's.
     

    Attached Files:

    Last edited: Jun 20, 2015
  28. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Did you, like ravenworks2, previously have an AMD card in the machine and then switch to an NVIDIA card?
     
  29. ravenworks2

    ravenworks2

    Joined:
    Apr 26, 2013
    Posts:
    21
    cyberpunk, I'm so glad you found this thread -- my main monitor (the one that I said made the problem go away when I disconnected it) is ALSO connected over DisplayPort -- and when I swapped it for a DVI cable, the problem went away!! This isn't a permanent fix, because I don't have enough non-DP ports on my 970 for all my monitors, but at least we've got it narrowed down one step further!

    Can you try the same thing on yours? Narrow your screens down to just the number you're able to connect over DVI, then test those screens once over DP and once over DVI… (And out of curiosity, what are the resolutions on your monitors?)
     
  30. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    @superpig: Thanks for the quick response. No, I never had an AMD card in this machine. I should have mentioned the specs, which are below. I'm running Windows 8.1.

    Intel i7-5960X @ 3.0GHz | Asus X99-Deluxe | EVGA GTX 980 x 3 | Corsair Vengeance LPX 32GB DDR4 | Samsung 840 Pro 512GB | WD Black 4TB x 2 | Corsair Obsidian 550D | Corsair Hydro H55 | Corsair AX1500i | Asus Rog Swift PG278Q x 3 | Nvidia 3D Vision 2

    @ravenworks2: Yes, I am also using DisplayPort on these monitors. The resolution is 2560x1440 for each screen. Unfortunately, these monitors only have a single DP connection, there are no other options. I did try to unplug 2 of the monitors, and it did help. With only 1 monitor connected, the hang/stall is only for around 5 - 10 seconds, though it still happens.

    I also tried on my other computers, and the app ran fine. One of the machines was using Nvidia 470's in SLI with the same latest Nvidia driver (353.06) and it launched with no problems. This machine has a single 1080P monitor on DL-DVI. Then I tried with an AMD 280X and a 720P HDMI display, also no problems.
     
  31. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Alright, so this sounds increasingly like a DisplayPort-specific problem, then... let me check with our QA department as to whether we have any test rigs set up with DisplayPort. (It's possible I won't hear back until Monday, just so you know).
     
  32. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    @superpig: Thanks so much. Looking forward to your reply.
     
  33. mdholo

    mdholo

    Joined:
    Sep 19, 2012
    Posts:
    2
    I too am experiencing this issue. I have a Nvidia GTX 970 and a Dell U2515H running at 2560 x 1440 on Windows 7. Using DVI or HDMI doesn't cause this problem, only display port.
     
  34. karkarotten1337

    karkarotten1337

    Joined:
    Jun 21, 2015
    Posts:
    2
    I got the same problem with Nvidia GTX 980 and a AOC G2460PQU running at 1920x1080@144hz over DisplayPort. Again using VGA, DVI or HDMI doesn't cause this problem.
     
  35. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    Seems like this is likely related to DisplayPort. Sadly, my monitors don't have any other ports so I can't verify this myself. Has anyone from Unity been able to give it a go and reproduce this problem?
     
  36. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    We've successfully(-ish) reproduced the problem internally - no 30-second delays, but a noticeable 5-second one at least. So this has officially gone from 'bigfoot' to 'known issue' status. I'm not sure when it'll be fixed but we can at least confirm that you guys aren't crazy :)

    It's bug 709990 if you guys want to keep tabs on it.
     
  37. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    Thanks superpig. The delay seems to compound with multiple monitors. If I just have one monitor plugged in, it's closer to maybe 5 - 10 seconds. But with 3 monitor connected it triples the lag time.
     
    Last edited: Jul 26, 2015
  38. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Ah, that probably explains why we only saw such a short delay internally - finding someone in the QA department with a DisplayPort rig was hard enough, finding someone with multiple DisplayPort monitors would be even harder :)

    Still, this is very useful to know - implies that we should be able to exaggerate the issue if we need to.
     
  39. Alleviator

    Alleviator

    Joined:
    Nov 13, 2014
    Posts:
    1
    Looks like I have similar problem. But in my case there are 3 FullHD monitors connected to GeForce660 card with 1 HDMI and 2 HDMI-DVI cables (3 HDMI inputs on monitor, 1 HDMI + 2 DVI outputs on videocard). When I run any Unity project compiled for D3D11 (even that simple project from this thread) the same "sluggish" problem appears. Other (not Unity) D3D11 games start fast. When I use DVI inputs of my monitors - no problem at all. When I disable NVidia Surround and start Unity game using "-screen-width 5760 -screen-height 1080 -screen-fullscreen 0 -popupwindow" parameters - everything looks fine. So looks like this problem is somehow connected with Nvidia Surround and HDMI too, not only with DisplayPort. Superpig, could you please test it in your QA department?
     
    Last edited: Aug 20, 2015
  40. 8iVR

    8iVR

    Joined:
    Oct 29, 2014
    Posts:
    9
    I am also able to reproduce this.

    I use one DVI and two DP monitors.

    Having either of the DP monitors in use causes any Unity game I launch to stutter and sluggishly load. It causes the entire computer to drop down to ~5fps with the mouse input being crippled.
    Marking the DVI monitor as my main monitor and unplugging the DP monitors is perfectly smooth.
    Interestingly having the DP monitors plugged in, with the DVI monitor as the main monitor causes it to load sluggishly, but it doesn't appear to be as bad as if one of the DP monitors was marked as the main monitor.
     
  41. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    Just like to mention it happens even with released games like Beyond Eyes and Her Story.
     
  42. Arkhalis

    Arkhalis

    Joined:
    Oct 10, 2015
    Posts:
    1
    I am having this exact issue, though it doesn't always seem restricted to Unity games. The problem does present for SURE when playing any DX11 Unity game, especially anything showing the unity personal settings window. The problem does go away when removing my DisplayPort monitor (which is not an option for me to do permanently)

    I've attached my dxdiag file but here's a summary:
    OS: Windows 8.1 Pro 64bit
    MB: Z97X-UD3H
    CPU: Intel Core i7-4790k
    GPU: NVIDIA GeForce GTX 780
    RAM: 32GB 2133Mhz DDR3
    SSD: 2 x Samsung SSD 850 EVO 250GB
    Mouse: Cyborg M.M.O. 7
    KB: Razer BlackWidow Chroma
     

    Attached Files:

  43. murrydev

    murrydev

    Joined:
    Jul 4, 2015
    Posts:
    7
    Facing the same issue here. Running 3 monitors, 2 on displayport. I did have a radeon card installed originally, then installed 2x 980's. I have an i7 4770. Drives me sort of crazy here...
     
  44. 8iVR

    8iVR

    Joined:
    Oct 29, 2014
    Posts:
    9
    In another case yesterday,

    Using a DP monitor with the HTC Vive plugged in. When I went to launch our application it went through the same stuttering and sluggishness, before finally throwing an error about not being able to 'Set the Resolution to 1024x768 0hz' it also said something about iterating through all available resolutions before failing. It then closed the window.

    I've only seen it happen during a few launches time yesterday. If I see it again I'll grab a screenshot and logs.
     
  45. bteitler

    bteitler

    Joined:
    May 11, 2014
    Posts:
    52
    Same issue. Goes away if I use a different monitor.. unfortunate since this is my best monitor I want to use for gaming (ASUS VG248QE)
     
  46. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    Just like to update that this issue is no longer happening for me.

    I'm using Unity 5.2.1p3 and Nvidia driver 353.38.
     
  47. bteitler

    bteitler

    Joined:
    May 11, 2014
    Posts:
    52
    Yeah seems to have been fixed somewhere along the line.. hurray!
     
  48. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Ah, sorry, I forgot to post here! We developed a fix for this back in early September, it shipped in Unity 5.2.1p1 and in the main release 5.2.2. If you're using any game developed with 5.2.2 or later and you still see this problem, please speak up.
     
    Tyen_ and cyberpunk like this.
  49. bteitler

    bteitler

    Joined:
    May 11, 2014
    Posts:
    52
    Thanks for popping in. Is there any way to give this higher visibility to developers? I think most developers have no idea this is an issue b/c most people still don't use display port, and I don't think testing with different display connectors is a common QA test. Almost every Unity built demo I've ever tried has this issue and still does. It seems to be particular nasty on Windows 10, resulting in complete PC freezes in some cases.
     
    cyberpunk likes this.
  50. Tyen_

    Tyen_

    Joined:
    Jun 4, 2014
    Posts:
    12
    After installing Unity5.2.2 the sluggishness effect is lessened, but it's still there.

    @superpig I'll send you my DXDiag