handzlikchris / handzlikchris/FastScriptReload

ImmersiveVRTools.Common.Runtime: UnityMainThreadDispatcher can't be initialized on worker thread

Aperta
#134 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
2.2k
Fork
167
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Just got hit by an exception where code tried to get the `.gameObject` property from a worker thread. It was during `SafeInvoke(HotReloadFailed, changesAwaitingHotReload);` triggering `ProjectWindowReloadStatusIndicatorDrawer.OnHotReloadFailed` which in turn accesses `UnityMainThreadDispatcher.Instance` which in `SingletonBase` will try to access stuff that should only be accessed on the main thread in case there is no singleton instance. Sorry for oral account of the callstack but my debugger got detached when I was poking around and CBA to repro. 😅

Anyway, maybe the main thread dispatcher needs to eaglery be inited from the main thread (RuntimeInitializeOnLoad?) if its means to be accessed from a worker, or just use another singleton implementation that doesn't hit Unity's API.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.