Authentication パッケージを使用してサインインする
Sign players in to Vivox using the Unity Authentication Package.
読み終わるまでの所要時間 1 分最終更新 23日前
前提条件: Unity Package Manager の Vivox パッケージを設定します。 Vivox のサインインを最も簡単に管理する方法は、Unity Authentication パッケージを使用する方法です。 Authentication パッケージを使用するには、以下のステップを実行します。
-
プロジェクトの ファイルに
manifest.jsonのエントリーが含まれていることを確認します。 詳細については、プロジェクトマニフェスト に関する Unity ドキュメントを参照してください。com.unity.services.authentication -
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)