Initialize all Unity Gaming Services with Services Core.
읽는 시간 2분최근 업데이트: 한 달 전
Services Core 패키지는 단일 호출로 모든 Unity Gaming Services를 초기화하는 솔루션을 제공하며, 여러 패키지에서 사용되는 공통 컴포넌트를 정의합니다. 이러한 표준화된 컴포넌트는 Unity Gaming Services 패키지와 작업할 때 전체적인 경험을 통합하는 것을 목표로 합니다.
참고
참고: 이 API는 Unity 에디터 버전 2019.4 이상에서 지원됩니다.
UnityServices
namespace Unity.Services.Core{ public static class UnityServices{}}
이 클래스를 사용하여 현재 프로젝트에 설치된 모든 Unity Gaming Services를 초기화합니다.
InitializeAsync
public static Task InitializeAsync(InitializationOptions options)
이 메서드는 현재 프로젝트에 설치된 모든 Unity Gaming Services를 초기화합니다. 이 메서드는 초기화 진행 상황을 모니터링할 수 있는
public bool TryGetOption(string key, out bool option)public bool TryGetOption(string key, out int option)public bool TryGetOption(string key, out float option)public bool TryGetOption(string key, out string option)
using System;using Unity.Services.Core;using Unity.Services.Core.Environments;using UnityEngine;public class InitializeUGS : MonoBehaviour { public string environment = "production"; async void Start() { try { var options = new InitializationOptions() .SetEnvironmentName(environment); await UnityServices.InitializeAsync(options); } catch (Exception exception) { // An error occurred during initialization. } }}
초기화 디버깅
Services Core 버전 1.4.2 이상에서는 디버깅 목적으로 상세 모드를 활성화할 수 있습니다. 상세 모드를 활성화하면, Services Core SDK는 모든 서비스가 공유하는 공통 구성에 대한 정보를 에디터의 콘솔에 기록합니다. 상세 모드를 활성화하려면 다음을 수행합니다.