handzlikchris / handzlikchris/FastScriptReload

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

Offen
#134 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
2.2k
Forks
167
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with the reported call chain from SafeInvoke(HotReloadFailed, changesAwaitingHotReload) through ProjectWindowReloadStatusIndicatorDrawer.OnHotReloadFailed, UnityMainThreadDispatcher.Instance, and SingletonBase. Determine which initialization path accesses Unity APIs from the worker thread. Done means the reported hot-reload failure no longer triggers a worker-thread Unity API exception, with the relevant behavior verified in Unity.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, unity
Bereich
devtools, game-dev
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.