게임에 로그인
How to sign in a player to Vivox services.
읽는 시간 1분최근 업데이트: 19일 전
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 }}