Authentication パッケージを使用してサインインする
Sign players in to Vivox using the Unity Authentication Package.
読み終わるまでの所要時間 1 分最終更新 7ヶ月前
Vivox のサインインを最も簡単に管理する方法は、Unity Authentication パッケージを使用する方法です。
Authentication パッケージを使用するには、以下のステップを実行します。
-
プロジェクトのファイルに
manifest.jsonのエントリーが含まれていることを確認します。com.unity.services.authentication詳細については、プロジェクトマニフェスト に関する Unity ドキュメントを参照してください。 -
Vivox の機能を使用する前に実行するスクリプトに以下のコードスニペットを実装して、を初期化します。
UnityServices
using System;using UnityEngine;using Unity.Services.Authentication;using Unity.Services.Core;using Unity.Services.Vivox;async void Start(){ await UnityServices.InitializeAsync(); await AuthenticationService.Instance.SignInAnonymouslyAsync(); await VivoxService.Instance.InitializeAsync();}
-
を使用してサインインします。
VivoxService.Instance.LoginAsync(LoginOptions options = null) -
チャンネルの種類に応じて、以下のコードサンプルのいずれかを使用して、チャンネルに参加します。
ポジショナルチャンネルまたはノンポジショナルチャンネルに参加する場合は、以下を使用します。
VivoxService.Instance.JoinGroupChannelAsync(string channelName, ChatCapability chatCapability, ChannelOptions channelOptions = null), VivoxService.Instance.JoinPositionalChannelAsync(string channelName, ChatCapability chatCapability, Channel3DProperties positionalChannelProperties, ChannelOptions channelOptions = null)
エコーチャンネルに参加する場合は、以下を使用します。
VivoxService.Instance.JoinEchoChannelAsync(string channelName, ChatCapability chatCapability, ChannelOptions channelOptions = null)