[unity/error] Unity IAP: Unity In-App Purchasing requires Unity Gaming Services to have been initialized before use.

dev.hyeon·2024년 3월 27일
0

오류

목록 보기
2/2

Unity Gaming Services 초기화 에러

Unity IAP: Unity In-App Purchasing requires Unity Gaming Services to have been initialized before use.

  • Unity IAP Pakage Version을 4.4.1로 올린 후 발생하는 오류이다.

Unity IAP API를 사용하기 전에 Unity Gaming Services를 초기화해야 한다.

코드리스 IAP에서는 IAP Catalog에서 Automatically initialize Unity Gaming Services를 선택하여 Unity 게임 서비스 자동 초기화를 활성화할 수 있다. 이 경우 애플리케이션이 시작될 때 Unity 게임 서비스가 즉시 초기화된다.

코드리스를 사용하지 않는 일반적인 환경에서는 초기화 코드를 작성해서 Unity 게임 서비스를 초기화 해야 한다.

private const string Environment = "production";

async void Start()
{
    try
    {
        var options = new InitializationOptions()
            .SetEnvironmentName(environment);

        await UnityServices.InitializeAsync(options);
    }
    catch (Exception exception)
    {
        // An error occurred during services initialization.
    }
}

참고

Initialize Unity Gaming Services

0개의 댓글