Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Constant Crashes - Failed to present D3D11 swapchain due to device removed.

Discussion in 'Editor & General Support' started by Mad_Mark, Oct 14, 2020.

  1. ItzELECTRO

    ItzELECTRO

    Joined:
    Jun 6, 2021
    Posts:
    4
    Windows 11 (Ver: 25931.1000)
    Unity Ver: 2022.3.7f1 LTS
    CPU: Intel i3 10100f (Overclocked from 3.6Ghz to 4.3)
    GPU: RTX 2060 6GB VRAM (Overclocked +220 Core Clock +200 Memory Clock)
    RAM: 16 GB DDR4 G-Skill 2400 MHz (Overclocked to 2666)
    Displays: main horizontal monitor full HD 75 Hz, secondary vertical monitor 1024 x 1280 75 Hz

    Problem persists even if I turn off all overclocks, only happens in a specific part of a specific scene where there are a lot of objects, and only when the post processing volumes are on.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,628
    Can you submit a bug report with that scene in question? https://unity.com/releases/editor/qa/bug-reporting
     
  3. EnUddaGamer

    EnUddaGamer

    Joined:
    Nov 11, 2016
    Posts:
    6
    Hey everyone.

    For the last two weeks I've started having the same issue. However, in one of my previous projects I used URP in 3D and created a game for several weeks (for fun) without any shaders, and no crashes at all. In my current project I use the Stylized Water 2 shader and I get the crash atleast once a day if I sit for a few hours and work on the project. The only similar thing to other crashes I've read about, is the shader part. Hence, dx11 problems with the GPU.

    I've not found any fixes, and have ran software such as Memtest, Prime95, OCCD, FurMark, etc. to test all of my PC components to their max capabilities, and it always comes back clean. If I play games, work on other things or just use my PC normally this issue never occurs.

    I also have the latest drivers in everything, haven't tried switching drivers since it feels useless to do as the problem recides in Unity with shaders apparently.. atleast for me.

    If I try to replicate it, the best thing I can do is to start my game where I can sail my ship across the seas and simply just wait.. in 5-15m the crash will occur. I have quite low ram on the PC (16gb ddr4 3200mhz) but my GPU (rtx 3070ti) and CPU (5800x) is more than capable to run such a game as the one I am creating, even with the editors high PC resource needs.

    Hopefully this can get resolved soon, tried all fixes but to no avail.

    Regards,
    Victor
     
  4. rubendariohh

    rubendariohh

    Joined:
    Oct 14, 2017
    Posts:
    32
    Windows 11 22H2 Laptop
    Nvidia RTX 3070
    Unity 2022.3.7
     
  5. hibbygames

    hibbygames

    Joined:
    Mar 19, 2015
    Posts:
    48
    Windows 10
    GTX 1660 AND GTX 670 both crash
    Unity 2022.3.8
     
  6. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    197
    Hey guys, might be unrelated to everyone's crashes, but figured I'd chip in in case I can save at least one person from the annoyance we went through the past month.

    After angrily having crashes for the last month every time we generated a character in run-time and getting a damn swap chain crash, I finally forced myself and downgraded the engine version back to the original 2022.3.1f1 release.

    Lo and behold, the crashes are fixed. We tried this on 3 different PCs dealing with the issue and it fixed it for everyone.
    Two PCs running Windows 10, one Windows 11.
    All running NVIDIA cards (1060, RTX 2070, RTX 3080), 2 Intel i7, 1 Ryzen 5800x.

    So after extensive digging for what script, asset, or change to the render pipeline did it, after multiple library rebuilds, and bothering with testing render backends like dx12 (performance was worse across the board for everyone) or Vulcan, in the end, it was - and I should have suspected this right away - Unity breaking something that simply worked perfectly fine just weeks prior.

    For everyone dealing with this issue, I'd recommend forcing yourself to downgrade the editor (or upgrade it). Might take care of your issue.

    For 2022.3 users I **believe** it was still fine back when we were working on 3.4 but I can't be bothered to download every single unity version now and check one by one.


    EDIT: WELP, it's back to crashing for everyone again after no idea what, be it PC restart or editor restart - hard to say. At this point we're completely lost as to what causes this but working reliably is completely impossible.

    EDIT 2 (11/09):
    We ended up porting to OpenGL. No more crashes, The in-editor framerate has dropped by 3-5 fps on average so not too terrible. Will periodically check back on DX11 if the issue got fixed though. If you need to keep working at all costs, that's the fastest route that will cost the least FPS loss.
     
    Last edited: Sep 11, 2023
  7. huqianchuan_wepie

    huqianchuan_wepie

    Joined:
    Aug 24, 2023
    Posts:
    1
    We have this issuse on 2022.2.20f1.After upgrade to 2022.3.8f1,everything goes fine.
     
  8. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    197
    If someone encounters this issue still running DX11 I recommend looking at NVIDIA 527.56 drivers... they're ancient (December 2022) but no more reported crash issues on anyone's end here.
    It would be great if someone could also test it out and confirm they have gotten rid of the issue using older drivers.
     
  9. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    514
    2022.3.9f1, still crashes on DX11, Nvidia RTX 3050, Windows 11.
    Changed editor to OpenGLES3 graphics. Editor crashed once but looks like was random in UI scene (not in the problematic scene while I used DX11)
     
    Last edited: Sep 14, 2023
  10. XDchihcikoXD

    XDchihcikoXD

    Joined:
    Oct 10, 2017
    Posts:
    1
    2023.1 Happens to me as well

    Windows 11 Pro Ver 22621.2283
    CPU: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz 3.79 GHz
    RAM: 32.0 GB
    GPU: NVidia RTX 3070 8GB vram

    At first I thought it was a faulty renderer feature I had made but even after removing it completely it still happens, I also experience extreme lagging issues with small particle systems.

    Also crashes immediately if I open Unity or drag it to my 4k screen
     
  11. axelstewart

    axelstewart

    Joined:
    May 17, 2018
    Posts:
    13
    Checking back in to say I switched a project from URP back to standard on 2022.3.5f1 and it made things worse. The issue had been dormant for some time. Resizing the scene window is an instant crash, but otherwise it happens somewhat randomly.
     
  12. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    129
    Just chiming in with my experience with this problem.

    I'm currently running Unity 2020.3.48 LTS (the last 2020 release) on a fairly ancient Intel i7 4790K, 32GB RAM and nVidia RTX 2080, currently using driver 536.67 on Win 10 21H2.

    I have a 4K display (Samsung HDR TV via HDMI) front and center with a portrait rotated 1440p HP monitor (via DisplayPort) on the RHS.

    I used to have this issue every single day with previous 2019 and 2020 editor versions. In fact I waited for it - Unity was going to crash within 10-15mins of starting. Guaranteed. Even if left alone with no other apps running, but you could usually coax a crash by just inspecting a prefab without even loading a scene. The editor window just freezes, usually blacks out, the whole Win desktop stalls, blinks, and then the DX swapchain error shows.

    I could then restart Unity straight away safe in the knowledge it wouldn't crash again. Switch the PC off at night, and the cycle starts again next day.

    This is all working on the same (DX11) game project for the last 5 years (solo dev). Note that the game's build never has these crashes, it's just the Editor.

    I chased through multiple nVidia driver versions (plus latest versions of all other drivers for my aging PC), upgraded through multiple Unity versions and updated Win10 (1903 -> 21H2) and nothing stands out as "fixing the problem".

    However one working pattern change I did make that results in stable "I don't expect it to crash at all" development is that I no longer use the secondary monitor as frequently. I mainly develop on the 4K monitor exclusively these days and there are no crashes. Sure enough though, when I enable the secondary display for occasional tasks (profiling, etc) the editor will crash within minutes.

    Gut feeling tells me that editor changes (v2019+) are conflicting with Win10's DX/D3D layer resulting in GPU crashes, possibly due to refresh rate conflicts (due to the multi monitor setup in my case).

    Also guessing there are just more Unity dev's using Win PC/nVidia hardware skewing the feedback (it looks primarily like an nVidia issue reading the discussion, but note there are some Apple, AMD GFX, and Intel Xe GFX users chiming in).

    TLDR: Apologies for the narrative rather than solutions, but those with multi-monitor setups might have something new to try out (see how you get on with a single display for a while).
     
    Last edited: Oct 10, 2023
    joshayumuss and CingMocha like this.
  13. V1R4J

    V1R4J

    Joined:
    Aug 30, 2023
    Posts:
    3
    I have a AMD Ryzen 9 5900HX processor and AMD Radeon RX 6600M gpu and I've been facing this problem since a couple of months. I never found a solution so now I have to remember to keep saving my project file after every 2 mins.
     
  14. FronkonGames

    FronkonGames

    Joined:
    Feb 24, 2022
    Posts:
    14
    2021.3.26f1 Happens to me as well

    Windows 11 Pro (build 22621)
    CPU: i7-8700K CPU @ 3.20GHz
    RAM: 32.0 GB
    GPU: NVidia RTX 3060Ti 16GB (driver 31.0.15.4612)
     
  15. andrew_2992

    andrew_2992

    Joined:
    Jun 27, 2015
    Posts:
    7
    I've been experiencing this as well. I've noticed that many times, but not all, my phone seems to disconnect and ask me if I want to enable USB debugging. I would always tick off remember this device or always enable USB debugging on this device etc (Can't remember exact wording). Game is targetting Android and I'm running the Unity remote on a Google Pixel 6.

    Unity v2022.3.5f1
    CPU Intel i7-12700 2.10 GHz
    Windows 11 Home Build 2261.2861
    RAM 16GB
    Nvidia GeForce RTX 3060 Driver v31.0.15.3667
     
  16. V1R4J

    V1R4J

    Joined:
    Aug 30, 2023
    Posts:
    3
    Did it get fixed? This has been bugging me a lot for the past few months
     
  17. weltonsilva

    weltonsilva

    Joined:
    Oct 23, 2018
    Posts:
    1
    I found a solution.
    Go into the Library folder and cut the ShaderCache folder to another place, restart unity, it will work normally.

     
  18. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    197
    Not really a solution, it will come back after a while once you encounter the issue you had previously. One of your shaders is possibly crashing for some reason, and you haven't triggered the cache for it yet. You can delete the entire LIBRARY folder freely since its content gets recreated on Unity restart. Clearing the Library folder is a known fix for a lot of Unity issues. An example would be URP's Stylized Water 2 shader integrated with Buto - that produced a swapchain crash for me 100% of the time till I got rid of said shader. It was corrupt for whatever reason. Your case might naturally be different.
     
  19. unity_7599EF0CF77C8D1D54D4

    unity_7599EF0CF77C8D1D54D4

    Joined:
    Feb 6, 2024
    Posts:
    1
    This worked for me, incredible
     
  20. honor0102

    honor0102

    Joined:
    Jan 30, 2019
    Posts:
    25
    to anyone facing this error
    I tried this method and it helped,it may work for you too:
    for this method ,you need to have Directx12 in unity graphics API list of player settings for PC build

    ----

    change the project graphic engine API of PC Build Player Settings(NOT ANDROID OR IOS Player settings) to DirectX12,as simple as that
    (it does not affect the mobile build version if you change the pc version player settings)

    To do this:
    (first of all backup your project settings: at ProjectSettings/ProjectSettings.asset)

    1-Open the Player settings (menu: Edit > Project Settings, then select the Player category) and navigate to PC build tap

    2-Navigate to Other Settings and uncheck "Auto Graphics API for windows" if its checked

    3-Add Directx12 and move it to top of that list,then restart the editor and try working with project again!
    api.jpg
    help page for changing graphic API: https://docs.unity3d.com/Manual/GraphicsAPIs.html



    Notes:
    1-
    Thanks to u/animasting in reddit:
    If Unity keeps crashing after changing API to DX12 try opening the project after deleting the Library folder and reopen it again,or try replacing the backed up project settings with old settings.
    2-
    you probably face lower fps or some unstablities,yet,better than constant crashing because of that error!
     
    Last edited: Feb 20, 2024