Failed to present D3D11 swapchain due to device reset/removed. List of Solutions

For reference, the bug report is IN-41214.

So this unrecoverable error can happen for many but essentially your graphic card resets because it’s been busy for too long. In my case, if I didn’t click ok fast enough I would get a BSOD VIDEO_TDR_FAILURE. I’m listing all the fixes I’ve found and tried, hoping that it helps you find a fix faster. if you find a fix that’s not on the list, please comment on the thread. Remember to include links.

In my case, Unity was using my integrated GPU instead of my dedicated one.

To any Unity devs reading this: I completely get that resources are limited and the forum and bug reports are what we should be using, when on a free license. However, this error seems like quite a pain point for the community and it would be great if someone could look into this and make solving this error a bit easier. I hope my collection of solutions makes it easier to investigate. I’m taking the liberty of tagging some Unity devs who have responded to threads about this error. @Tautvydas-Zilys @Soner-Sen @LeonhardP @aleksandrk

As for bug reporting, in my case, this seems to corrupt some of the files and so the bug report application would throw an error about files being unreadable. And customer support told me they were nontech support only. I eventually got a project to crash without corrupting the files and was told to check my drivers (IN-41214).

I hope I don’t offend anyone with the tags, I’ve been chipping at this for weeks in my spare time and am genuinely willing to help out in any way I can. Please reach out if I can help.

1) Set the Prefered graphics card in Windows settings (this worked for me)
Note: I had confirmed that the editor was using my integrated Intel GPU through the Task Manager’s Performance tab. The integrated graphics card is less powerful so it’s understandable that this one crashes. And noticed a message in the Nvidia Control Panel that said graphic card selection was handled by Windows now.

Settings>System>Display>Graphic Settings>“choose an app to set preference”>Desktop app>browse

Find the unity.exe for the editor install you’re using and selected, “options” I selected “High performance” which listed my Nvidia GPU

2) Nvidia Control Panel Settings
Note: there are two tabs, one for your system and one for specific processes. Use the one for specific processes.

3) Exclude unity.exe from your processes in your Antivirus settings
There are a few sources claiming you should disable your antivirus, I suspect that the safety features are slowing down or blocking the GPU processes. I don’t recommend turning your antivirus off permanently. you could try temporarily. I don’t have all the links but some people have reported success excluding the process or changing antivirus.

4) Delete the library file in the project file

5) Inplace Windows Update
A Microsoft person recommended I do an in-place upgrade/install of the latest Windows version, just make sure you select the option to “keep my files” and optionally “keep my apps”. Not keeping the apps will also reset your settings which is more likely to help.

NOTE: I have not tried the remaining solutions, as I wanted to avoid changing settings that would affect other applications and I eventually found my solution. However, others have reported success. I highly recommend trying the above solutions first as they are less risky (well… number 7 is fine).

6) Changing TDRDelay and TDRDdiDelay
Note: this is a more risky fix as it basically tells Windows to ignore your graphic card when it’s unresponsive for a bit longer than usual. this could also cause crashes on your laptop if you completely remove the TDRDelay or set it beyond reasonable values. By crash I mean BSOD VIDEO_TDR_FAILLURE kind of crash. Make sure you bookmark the Adobe link as it has instructions on how to undo this change. it could be the only solution that works if your integrated graphics card is too old/weak to handle the unity graphic demands fast enough to avoid Windows resetting the graphics card.

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

Use the guide below to make the change as it explains in nice detail what you’re doing.
https://substance3d.adobe.com/documentation/spdoc/gpu-drivers-crash-with-long-computations-tdr-crash-128745489.html

7) -force-d3d11 or -force-d3d12
Note: this overrides some of the unity settings, my guess is that without the overrides the dedicated GPU is selected instead of the integrated one.

more info:

8) Disable Integrated graphics card

Note: Don’t do this if you only have one graphic card. In fact, you should probably be using the above methods if you have a dedicated graphics card. But hey if nothing works, then you can try this.

2 Likes

Could you please submit this through the bug reporter? If the project is corrupt then try doing it with a new project. A bug report on the forum is going to be very hard for us to track and will likely be lost after a few days. Submit the contents of this post in a bug report and post the bug number. I’ll ask QA to take a look and you can then talk to them though the bug report if they have followup questions.

I managed to repeat this with another project without the corruption and report it some time ago before making this post (bug number IN-41214), I’ll paste this post’s text as a follow-up. I’ve also added the bug number to my original post on this thread.

1 Like

I started having this D3D11 issue after updating Windows 11 to 22H2.

This Windows update is causing mayor issues for Nvidia Cards owners and DX11 based apps.

For instance, I started having this opened issue by Nvidia when web browsing with Google Chrome. Changing Chrome to use OpenGL instead of DX11 fixed the issue:

Open Issues:
Small checkerboard like pattern may randomly appear in Chromium based applications [3992875]

https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/524211/geforce-grd-53699-feedback-thread-released-8823/

Unity was working perfectly fine for me before the Windows 22H2 Update. Now I have several D3D11 swapchain crashes. I have to restart my laptop everytime. If I restart Unity without restarting my lasptop the error happens again.

I follow all these steps with no results:

Set the Prefered graphics card in Windows settings for Unity (High performance)
Nvidia Control Panel 3D Settings for Unity (prefer maximum performance, Threaded Optimization off, Tripple Buffering off, Vertical Sync off)
Lenovo Hybrid Mode turned off
Last Nvidia Studio Driver Installed

My Setup:

Lenovo Legion 5 Pro 16ach6h, Nvidia Geforce Rtx 3070, Unity 2022.3.7

Hi! Any luck fixing this on your end? Some of our PCs still see this, esp. people running 30xx cards.

Nvidia should fix their failed drivers asap, this is getting out of hand.

I cant imagine how they work producing cards that randomly crash by some erroneous wait time estimation.

This is a huge bug, i mean out of this world huge. How come noone notice it ? Msybd did not test DX11 at all and focused on the DX12 ?

Get a new expensive GPU only to be useless crashing all the time, just crazy stuff

I replied with a fix in a few other threads & confirmed it working with multiple others with similar issues. Download nVidia drivers version 527.56 from 12/08/2022 and update once a month or two till they fix the dx11 bug. Worst case roll back.

The issue is that users may use the latest drivers, this is the expected. And games will crash on them. It is a game over situation. This cant be solved by reverting to older working drivers on our side or any other method, this should just work and never crash.

Now having a driver that crashes the games is beyond imagination, given this did not happen before.

They are just failed as a company to deliver, breaking something that was working fine even on my old 1050gtx.

People buy a 4070gtx, just to have constant crashes, is beyond imagination.

Imo they should stop everything and focus on solving this issue, as selling something that does not work should be illegal and a fraud.

If is a hardware issue they should recall the GPUs and give actual working hardware to existing users.

Possibly may also be related to something that Unity does that amplifies this issue, starting with Unity 2021, since 2019 never had such problems.

This bug imo is a failure of the industry, it is so severe that i cant imagine how can trust any hardware or game to not just crash randomly.

I wonder why they just dont have an option to let the GPU just wait or change this stall time or remove it since obviously the check is implemented wrong. If they are incompetent to make it work should quit the job. It is like making a house without few of the cement columns and pretend that all is fine and house owner can add a few later to make it work and not fall down.

An issue like this is not for us to try resolve, is for NVIDIA and Unity to fix and should be their only priority, otherwise they dont have a real business.

Well I sent in a bug report to NVidia about this, maybe you should too if you can. Is sadly something the driver providers should IMO look at since it affects not just the editor but also game builds, and game crashes tend to be more the job of the actual driver developers.
Don’t think Unity cares about this, much as I wish they did.

Found this thread recently, I do have the same version of windows mentioned here and have that problem occuring randomly while working in Unity.
The first time I closed unity and tried to re launch it through the Hub an the error popped again, at that point the screen was fully bugged, displaying black in a lot of plaes where there should be something else like the desktop.
After rebooting Unity Hub was litterally gone from my PC, I had to re install it.

Just updated Nvidia driver to the last Studio driver released on 2023.11.1
Hopefully it’ll help.

Unfortunately is the latest drivers that caused the issue, e.g. all worked without a single error on my 1050GTX with my original drivers and years later after upgrading got the issue.

Is just the collective fail of GPU and driver manufacturers, they just failed imo, there is nothing else to say on this.

One of my staff started getting the issue yesterday, after yet another Windows update when it was fine for them during the last month. At this point I think Unity needs to fix it on their end, Microsoft and NVidia can’t be expected to fix the engine crashing for us. Not like it’s in their interest.

1 Like

I think they should collectively fix this, it is funny to see a bug that can randomly crash random games.

This is a stop all GPU industry event, I cant even grasp how they keep making these GPUs without fix this, it is like making knowingly something that does not work and is a clear fraud from NVIDIA side mainly, as seems their drivers cause the problem.

The issue is it does not crash builds, ever. Just crashes inside of the editor for devs. Never had someone who crashed in editor had it carry over into the builds so far, I believe.

Happened again after a few days free of problems. I have to reboot or nothing works after that.
Even after the reboot it immediatly happened again.
Ironicaly got a windows update after that. I do not know if it’ll change anything.
It’s really frustrating and scary, I do not need that and my clients won’t like it if I tell them the work might not be done in time because of a problem out of my control.

1 Like

Same issue here. Unity Editor is constantly crashing.

Maybe, but is hard to find out if the editor crashes directly and not practical.

Given this did not happen in older Unity versions i can see how it could be just some editor bug.

The issue is that Unity becomes more unstable, complex and lower quality software with new versions, largely because they clearly not test the releases enough, i think would require 10x the testing and slower pace of releases to have a stable platform and focus on fixing the problems than propagate them and create new in newer versions.

I’m getting the same crashes every once in a while, but I can’t figure out what action creates this crash. Sometimes it crashes while I’m editing a prefab, other times it crashes after code is recompiled when I make some changes in Visual Studio. This bug also makes the desktop background black on my computer.

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!

help page for changing graphic API: Unity - Manual: Graphics API support

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!

1 Like

Hmm, this didn’t help me