question

DetectivePig avatar image
DetectivePig asked

Problem with Unity -> GetGfxDevice() should only be called from main thread

When I star the application I get error:

ThreadAbortException
System.Threading.Thread.Sleep (System.Int32 millisecondsTimeout) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
PlayFab.Internal.PlayFabWebRequest.WorkerThreadMainLoop () (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:287)
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:293)
System.Threading.ThreadHelper:ThreadStart()

During playing everything works just fine. When I stop the game I get those:

GetGfxDevice() should only be called from main thread
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:ProcessJsonResponse(CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:461)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:261)
System.Threading.ThreadHelper:ThreadStart()

Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:426)
Rethrow as Exception: Unhandled exception in ProcessJsonResponse : https://DF74.playfabapi.com/Event/WriteEvents?sdk=UnitySDK-2.63.190312
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:ProcessJsonResponse(CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:461)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:261)
System.Threading.ThreadHelper:ThreadStart()

Will welcome any help/suggestions.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

I find this issue in Unity’s issue tracker: https://issuetracker.unity3d.com/issues/editor-throws-getgfxdevice-should-only-be-called-from-main-thread-errors-and-eventually-crashes-when-in-play-mode. Unity’s supporter said this issue fixed in 2018.3.8f1. You can check it.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.