「Unity/GooglePlayGames/v1からv2へ移行」の版間の差分
提供: 初心者エンジニアの簡易メモ
細 (Admin がページ「Unity/GooglePlayGames/ver2」を「Unity/GooglePlayGames/v1からv2へ移行」に、リダイレクトを残さずに移動しました) |
(→PlayGamesClientConfigurationエラー対応方法) |
||
| 行66: | 行66: | ||
PlayGamesPlatform.Instance.Authenticate(processAuthentication); | PlayGamesPlatform.Instance.Authenticate(processAuthentication); | ||
</pre> | </pre> | ||
| + | |||
| + | ==version2では起動時に自動ログインされる== | ||
| + | https://developer.android.com/games/pgs/unity/migrate-to-v2?hl=ja | ||
| + | <pre> | ||
| + | ゲームが起動すると、自動ログインの試行が表示されます。 | ||
| + | </pre> | ||
| + | とある | ||
2025年7月11日 (金) 04:12時点における版
目次
v1からv2へ移行
Play Games サービス v2 に移行する(Unity) https://developer.android.com/games/pgs/unity/migrate-to-v2?hl=ja
SignOutエラー対応方法
エラー詳細
error CS1061: 'PlayGamesPlatform' does not contain a definition for 'SignOut' and no accessible extension method 'SignOut' accepting a first argument of type 'PlayGamesPlatform' could be found (are you missing a using directive or an assembly reference?)
対応方法
- ((PlayGamesPlatform)Social.Active).SignOut(); + Firebase.Auth.FirebaseAuth.DefaultInstance.SignOut();
GetServerAuthCodeエラー対応方法
エラー詳細
error CS1061: 'PlayGamesPlatform' does not contain a definition for 'GetServerAuthCode' and no accessible extension method 'GetServerAuthCode' accepting a first argument of type 'PlayGamesPlatform' could be found (are you missing a using directive or an assembly reference?)
対応前
string authCode = PlayGamesPlatform.Instance.GetServerAuthCode();
対応後
PlayGamesPlatform.Instance.RequestServerSideAccess(
false,
authCode =>
{
try
{
Debug.Log("GooglePlaySignIn: RequestServerSideAccess Success: " + authCode);
}
catch (Exception ex)
{
Debug.LogError("Error getting credential: " + ex.Message);
}
}
);
PlayGamesClientConfigurationエラー対応方法
エラー詳細
error CS0246: The type or namespace name 'PlayGamesClientConfiguration' could not be found (are you missing a using directive or an assembly reference?) error CS0117: 'PlayGamesPlatform' does not contain a definition for 'InitializeInstance'
https://developer.android.com/games/pgs/unity/migrate-to-v2?hl=ja の対応の通り
対応後
Action<SignInStatus> processAuthentication = (SignInStatus status) =>
{
if (status == SignInStatus.Success)
{
// 成功
}
else
{
// 失敗
}
};
// GooglePlay認証開始
PlayGamesPlatform.Instance.Authenticate(processAuthentication);
version2では起動時に自動ログインされる
https://developer.android.com/games/pgs/unity/migrate-to-v2?hl=ja
ゲームが起動すると、自動ログインの試行が表示されます。
とある
