diff --git a/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs b/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs index 8bc8a8f15..0c69c9f9b 100644 --- a/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs +++ b/source/PluginDev/Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs @@ -261,6 +261,19 @@ private static Action AsOnGameThreadCallback(Action callback) return result => InvokeCallbackOnGameThread(callback, result); } + private static void InvokeCallbackOnGameThread(Action callback) + { + if (callback == null) + { + return; + } + + PlayGamesHelperObject.RunOnGameThread(() => + { + callback(); + }); + } + private static void InvokeCallbackOnGameThread(Action callback, T data) { if (callback == null) @@ -444,6 +457,7 @@ public void SignOut(Action uiCallback) { if (mTokenClient == null) { + InvokeCallbackOnGameThread(uiCallback); return; } @@ -462,7 +476,7 @@ public void SignOut(Action uiCallback) mAuthState = AuthState.Unauthenticated; if (uiCallback != null) { - uiCallback(); + InvokeCallbackOnGameThread(uiCallback); } }); } @@ -473,11 +487,11 @@ public void SignOut(Action uiCallback) mAuthState = AuthState.Unauthenticated; if (uiCallback != null) { - uiCallback(); + InvokeCallbackOnGameThread(uiCallback); } } - SignInHelper.SetPromptUiSignIn(true); + PlayGamesHelperObject.RunOnGameThread(() => SignInHelper.SetPromptUiSignIn(true)); } ///