Unity rendering 'freezes' when Native Plugin errors out
Hi all,
I'm using a native plugin called 'uDesktopDuplication', this is used for capturing the desktop as part of the project I work on, this can be found here if you want to look over it: https://github.com/hecomi/uDesktopDuplication/
The issue is that sometimes this plugin will cause Unity's rendering to freeze when it errors out, I believe it sometimes causes an access violation. Regardless, this causes the Unity build's log to be spammed with the following and for nothing to render anymore:
D3D11: Failed to create RenderTexture (670 x 1000 fmt 9 aa 1), error 0x887a0005
d3d11: failed to create 2D texture id=293 width=512 height=1024 mips=1 dxgifmt=65 [D3D error was 887a0005]
d3d11: failed to create 2D texture shader resource view id=293 [D3D error was 80070057]
I've been in touch with the developer of 'uDesktopDuplication' to try to fix the issue but as it's rare/specific to some people's systems, it's hard to find the true cause of it.
I'm wondering is it at all possible to catch the native plugin erroring out? Or have some other means of reloading it as to not totally break the build once it does. I assumed originally it was a Unity bug so I've been through 2019.1, 2, 3, and I'm now on 2020.1 as there was some bug reports with similar crashes that had been resolved.
Let me know your thoughts on this please. :)