기술 자료

지원

Authentication

Open Unity Dashboard

Authentication

시작하기

Follow this workflow to create a Unity account, link your project, and install the SDK to get started with Unity Authentication.
읽는 시간 1분최근 업데이트: 8시간 전

Authentication을 사용하려면 다음을 수행해야 합니다.
  1. UGS에 가입합니다.
  2. Unity 에디터 프로젝트에 대시보드를 연결합니다.
  3. 게임 코드에 SDK를 설치합니다.
  4. SDK를 초기화합니다.

가입

Unity 계정이 없으면 계정을 만들고 새 프로젝트를 만든 후 Unity Gaming Services에 가입합니다.
  1. Unity Dashboard에 로그인합니다.
  2. 측면 패널에서 Administration을 선택합니다.
  3. 상단 배너에서 Sign Up을 선택한 후 표시되는 지침을 따릅니다.

프로젝트 연결

프로젝트 ID를 통해 Unity 에디터에서 프로젝트를 Unity Cloud 프로젝트에 연결합니다. 프로젝트 ID를 가져오려면 다음 단계를 따릅니다.
  1. Unity 에디터 메뉴에서 Edit > Project Settings > Services 탭을 선택합니다.
  2. Unity ID로 로그인하지 않았다면 새 Unity ID를 생성하거나 기존 Unity ID로 로그인합니다.
  3. 새 프로젝트를 생성하려면 조직을 선택하고 Create를 선택합니다. 기존 프로젝트에 연결하려면 I already have a Unity Project ID를 선택합니다. 그런 다음 드롭다운에서 조직과 프로젝트를 선택하고 Link를 선택합니다.
이제 Services 창의 Settings 탭에서 프로젝트 ID를 확인할 수 있습니다.

SDK 설치

Unity의 최신 Authentication 패키지를 설치하려면 다음 단계를 따르십시오.
  1. Unity 에디터에서 Window > Package Manager를 엽니다.
  2. Package Manager에서 Unity Registry 목록 뷰를 선택합니다.
  3. Authentication을 검색하거나 패키지 목록에서 찾습니다.
  4. 패키지를 선택한 후 Install을 선택합니다.
자세한 내용은 패키지 관리자 기술 자료를 참고하십시오.

Unity Services SDK 초기화

게임에 Unity Authentication을 구현하려면 다음 코드 스니핏에 따라 프로젝트 내 모든 Unity Services SDK를 초기화합니다.
using System;using Unity.Services.Core;using UnityEngine;public class InitializationExample : MonoBehaviour{ async void Awake() { try { await UnityServices.InitializeAsync(); } catch (Exception e) { Debug.LogException(e); } }}

인증 이벤트 등록

플레이어의 상태에 대한 업데이트를 받으려면
SignedIn
,
SignInFailed
,
SignedOut
이벤트 핸들러에 함수를 등록합니다.
// Setup authentication event handlers if desiredvoid SetupEvents() { AuthenticationService.Instance.SignedIn += () => { // Shows how to get a playerID Debug.Log($"PlayerID: {AuthenticationService.Instance.PlayerId}"); // Shows how to get an access token Debug.Log($"Access Token: {AuthenticationService.Instance.AccessToken}"); }; AuthenticationService.Instance.SignInFailed += (err) => { Debug.LogError(err); }; AuthenticationService.Instance.SignedOut += () => { Debug.Log("Player signed out."); }; AuthenticationService.Instance.Expired += () => { Debug.Log("Player session could not be refreshed and expired."); };}