(Case: 1110540) GetGfxDevice() should only be called from main thread

(Case: 1110540)
I can’t reproduce with 2018.2.16 and never saw or had it occurre when using earlier 2018.2 - I have same hardware, same drivers, same windows. It starting happening right away with 2018.3.

I get an “GetGfxDevice() should only be called from main threaderror when I’m outside Unity window, for an example browsing in chrome. Sometimes it even crashes Unity. I had very few occasions when it started to crash when I had Unity Window in focus, but after a computer restart, it went back to only happening when I’m outside Unity window. I tried closing chrome, so it’s not chrome specific.

I have boiled it down to be a problem with using a sprite renderer with cast shadows enabled. It also crashes when making a build of the project and play it. It seems very easy to reproduce, just start a new 2D project in 2018.3, add a sprite, set diffuse material, enable cast shadow on it - also enable cast shadow on the directional light and project settings. I added a flat plane just to see the shadow. So now if I tab out and start, for an example, browsing around for 20secs or so I start getting the warning messages in Unity or it crashes (seems random which one it does)

So I could just not tab out (although it’s nice to search in the manual and what not). But the problem is sometimes it even happens when in the editor. Best solution for now is to just disable the directional light so there is no cast shadows from the sprite renderers - but then I can’t work on the visuals for the game.

Anyone else able to reproduce this?

Some more investigation. I tried on my laptop and don’t seem to be able to reproduce this. The hardware is obviously different from my main PC, but also laptop has Windows 8 (I use 10 on main PC).
I tried and disconnected my second monitor, same result.
I tried running Unity from safe mode, but it crashes right away (both 2018.2 and .3). 5.6 seemed to start fine though. So can’t try to reproduce the case.

Managed to get some different error messages I didn’t see before:
Gfx command not handled: 1035719799 (Last command: 10103)
Gfx command not handled: -986077864 (Last command: 1035719799)

Was able to reproduce on two computers running Windows 10, definitely a problem with 2018.3! Build typically crashes within a minute, editor less frequent - Hopefully this gets resolved soon.

I’m having the exact same issue. I didn’t realize it was the sprite renderer casting shadow caused the error until I see this post. Really hope this get resolved.

Yea, it took a while to narrow it down to this.
I don’t know if it helps, but if you file a bug report maybe it will get more attention, seeing more people have the problem.

I’m currently using sprites to cast shadows… needs fix ASAP.

Vote here guys: Unity Issue Tracker - Editor throws "GetGfxDevice() should only be called from main thread" errors and eventually crashes when in Play Mode