匿名ログインの使用
Implement anonymous sign-in to create new players without requiring any sign-in credentials or player input.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前
匿名ログインでは、プレイヤーからの入力を使用せずにゲームセッションの新しいプレイヤーが作成されます。これは、プレイヤーがゲームをすぐに始められるようにするための便利な方法です。 セッショントークンが SDK にキャッシュされている場合は、プレイヤーが匿名でサインインしたか、プラットフォームのアカウントを介してサインインしたかに関わらず、
SignInAnonymouslyAsync()匿名ログインを正常に実装したら、少なくとも 1 つのサポートされた ID プロバイダー と統合することをお勧めします。これにより、プレイヤーが別のデバイスからゲームを続行したり、必要に応じてアカウントを回復したりできるようになります。async Task SignInAnonymouslyAsync(){ try { await AuthenticationService.Instance.SignInAnonymouslyAsync(); Debug.Log("Sign in anonymously succeeded!"); // Shows how to get the playerID Debug.Log($"PlayerID: {AuthenticationService.Instance.PlayerId}"); } catch (AuthenticationException ex) { // Compare error code to AuthenticationErrorCodes // Notify the player with the proper error message Debug.LogException(ex); } catch (RequestFailedException ex) { // Compare error code to CommonErrorCodes // Notify the player with the proper error message Debug.LogException(ex); }}