ゲームにサインインする
How to sign in a player to Vivox services.
読み終わるまでの所要時間 1 分最終更新 23日前
Vivox SDK を初期化した後は、そのゲームに割り当てられた Vivox インスタンスにユーザーをサインインさせることができます。 プレイヤーに使用される名前は、Unity AuthenticationId か、Unity Authentication が使用されていない場合は新しい GUID になります。
初期化されたら、
VivoxService.Instance.LoginAsync- のオプションの引数は LoginOptions 構造体で、ユーザーの表示名を設定する、テキスト音声変換を有効にする、またはブロックユーザーリストをロードすることができます。
VivoxService.Instance.LoginAsync
VivoxService.Instance.ParticipantAddedToChannelVivoxService.Instance.ParticipantRemovedFromChannel- 表示名は現在のセッションでのみ有効で、Vivox ネットワークには保持されません。
- 表示名の最大長は 127 バイトです。
以下のコードは、サインインプロセスを開始する方法、DisplayName を "Bob" に設定する方法、テキスト音声変換を有効にする方法の例です。
LoginAsync が正常に呼び出されたときにイベントを受け取るために、using UnityEngine;using Unity.Services.Vivox;class LogInExample : MonoBehaviour{ . . . async void LoginUserAsync() { // For this example, the VivoxService is initialized. var loginOptions = new LoginOptions() { DisplayName = "Bob", EnableTTS = true }; VivoxService.Instance.LoginAsync(loginOptions) } . . .}
VivoxService.Instance.LoggedInVivoxService.Instance.LoggedOutVivoxService.Instance.LoggedInVivoxService.Instance.LoggedOutusing UnityEngine;using Unity.Services.Vivox;class LoginPropChangeExample : MonoBehaviour{ . . . VivoxService.Instance.LoggedIn += onLoggedIn; VivoxService.Instance.LoggedOut += onLoggedOut; . . . private void onLoggedIn() { // Operations as needed } private void onLoggedOut() { // Operations as needed }}