「Unity/GooglePlayGames/v1からv2へ移行」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==v1からv2へ移行== Play Games サービス v2 に移行する(Unity) https://developer.android.com/games/pgs/unity/migrate-to-v2?hl=ja ==SignOutエラー対応...」) |
(相違点なし)
|
2025年7月3日 (木) 19:11時点における版
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);
