Unity graphics randomly freezes

Hi,

I am having an issue with unity freezing apparently randomly and I am trying to identify if it is an issue on my side or in Unity.

Description of the issue :
In edit mode or play mode, after a few minutes, Unity will freeze (only the graphics). If I was in play mode I still hear all the audio being played (and from what I hear I can tell that the game is still running and responding to my inputs). It’s only the graphics that freeze. The menus are still functional though. I can still save my scene and reload my project for instance. Then, it works fine for a few minutes before it freezes again. If it was happening only in the Unity Editor, it would not bother me that much (though it’s quite annoying) but it also happens with the built executable.

I enabled full stack trace logging and here is what I find in the Editor.log file found under C :\users\username\AppData\Local\Unity\Editor (I copy here only the part that’s different form a log when no freeze happens) :

… Registered platform support
modules in: 0.0448706s. Native
extension for WindowsStandalone target
not found Load scene
‘Temp/__Backupscenes/0.backup’ time:
6.071385 ms Refresh: detecting if any assets need to be imported or removed
… Refresh: elapses 0.021138 seconds
(Nothing changed) Refresh: detecting
if any assets need to be imported or
removed … Refresh: elapses 0.013359
seconds (Nothing changed)
SUCCEEDED(hr) 0x0106AD32 (Unity)
StackWalker::GetCurrentCallstack
0x0106C7F0 (Unity)
StackWalker::ShowCallstack 0x0093B7E2
(Unity) GetStacktrace 0x00939689
(Unity) DebugStringToFile 0x00939A7A
(Unity) DebugStringToFile 0x01631069
(Unity) D3D11Window::EndRendering
0x01649D4A (Unity)
GfxDeviceWorker::RunCommand 0x0164B14E
(Unity) GfxDeviceWorker::Run
0x008EAF6F (Unity)
Thread::RunThreadWrapper 0x766A62C4
(KERNEL32) BaseThreadInitThunk
0x773C0609 (ntdll)
RtlSubscribeWnfStateChangeNotification
(Filename:
C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/D3D11Window.cpp
Line: 215)

d3d11: failed to create vertex buffer
of size 3360 [0x887A0005] d3d11:
failed to create index buffer of size
312 [0x887A0005] d3d11: failed to
create vertex buffer of size 1440
[0x887A0005] d3d11: failed to create
index buffer of size 144 [0x887A0005]
d3d11: failed to create vertex buffer
of size 1824 [0x887A0005] d3d11:
failed to create index buffer of size
192 [0x887A0005] d3d11: failed to
create vertex buffer of size 22944
[0x887A0005] d3d11: failed to create
index buffer of size 2076 [0x887A0005]
SUCCEEDED(hr) 0x0106AD32 (Unity)
StackWalker::GetCurrentCallstack
0x0106C7F0 (Unity)
StackWalker::ShowCallstack 0x0093B7E2
(Unity) GetStacktrace 0x00939689
(Unity) DebugStringToFile 0x00939A7A
(Unity) DebugStringToFile 0x01631069
(Unity) D3D11Window::EndRendering
0x01649D4A (Unity)
GfxDeviceWorker::RunCommand 0x0164B14E
(Unity) GfxDeviceWorker::Run
0x008EAF6F (Unity)
Thread::RunThreadWrapper 0x766A62C4
(KERNEL32) BaseThreadInitThunk
0x773C0609 (ntdll)
RtlSubscribeWnfStateChangeNotification
(Filename:
C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/D3D11Window.cpp
Line: 215)

d3d11: failed to create vertex buffer
of size 3360 [0x887A0005] d3d11:
failed to create index buffer of size
312 [0x887A0005] d3d11: failed to
create vertex buffer of size 1440
[0x887A0005] d3d11: failed to create
index buffer of size 144 [0x887A0005]
d3d11: failed to create vertex buffer
of size 22944 [0x887A0005] d3d11:
failed to create index buffer of size
2076 [0x887A0005] SUCCEEDED(hr)
0x0106AD32 (Unity)
StackWalker::GetCurrentCallstack
0x0106C7F0 (Unity)
StackWalker::ShowCallstack 0x0093B7E2
(Unity) GetStacktrace 0x00939689
(Unity) DebugStringToFile 0x00939A7A
(Unity) DebugStringToFile 0x01631069
(Unity) D3D11Window::EndRendering
0x01649D4A (Unity)
GfxDeviceWorker::RunCommand 0x0164B14E
(Unity) GfxDeviceWorker::Run
0x008EAF6F (Unity)
Thread::RunThreadWrapper 0x766A62C4
(KERNEL32) BaseThreadInitThunk
0x773C0609 (ntdll)
RtlSubscribeWnfStateChangeNotification
(Filename:
C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/D3D11Window.cpp
Line: 215) …

And it goes on foerever with the “failed to create vertex buffer” and “failed to create index buffer”…

I tried to simplyfing my game as much as I could. My player rendering was composed of a lot of triangles so I replaced it by a simple cube but it did not help. (Right now my test scene is made of a plane, some cubes and a few cylinders and spheres) I’ve searched for similar issues online. Everytime someone mentions Unity frozen, it is suggested to see if there are infinite loops triggered in the code so I verified that (even though I don’t think it would be the reason because the game is still running) and I have no infinite loops. Almost all my loops are in the Start functions anyway. I updated my gpu driver but it didn’t help either…

I hope someone could help me with this issue.

I am running : Unity 5.4.1f1 Personal 32 bits (I tried 5.3 and 5.2 32 and 64 bits and I have the same issue)
Windows 10 64 bits
8 GM RAM

After writing all of this but before posting my question, I tried one more thing. I went to my device manager and saw there are 2 display adapters :
Intel(R) HD Graphics 4600
NVIDIA GeForce GT 740M

I disabled the Intel HD Graphics to force the use of the NVIDIA GeForce and after multiple attemps, I could not reproduce the issue (but because the issue is quite random, I am not sure yet if it really fixes it). In case that would be a work around. I would still like to understad what exactly happens and if I can do something about it. I don’t think this should be the fix to my issue.

While writing the question I found this one which seems to be the exact same problem but it does not have an official answer :

I’ll try what’s suggested in the only answer and post my findings here.

EDIT :

It seems disabling any one of the two display adapters bypass the issue. But as soon as I have both enabled, it is not long before the freeze happens again (couple of minutes).

I tried the crash detector in the other post but it doesn’t help as it terminates Unity as soon as I click the play button.

EDIT #2 :

It just happened again with one of the display adapters disabled. So no work around… I would appreciate if someone could help.

Same here … and it’s Nov 16-th 2016 now…
It seems to have started with Windows 10 newest updates…
Though we also had power failures, so it may be some files damaged, BUT - Unity will show such files in WHITE,
or any incompatible files - it always shows them in white color.
But - no any white files in any hierarchy, and this is still happening …
So… i’d only like to ask you:
do you have this in ALL of your projects, or just one ?
(so we can figure out more on this subject)…