원격 카탈로그 가져오기
결제 제공업체 스토어의 원격 카탈로그를 가져옵니다.
읽는 시간 1분최근 업데이트: 11일 전
배포한 원격 카탈로그를 명시적으로 가져오기 위해
StoreControllerRemoteCatalogProviderFetchRemoteCatalogRemoteCatalogProviderFetchProductsIProductServiceStoreControllerFetchProducts레퍼런스 정보
다음 요소는 결제 제공업체의 원격 카탈로그를 가져올 때 관련이 있습니다.파라미터 | 설명 |
|---|---|
| IAP와 함께 사용할 원격 카탈로그를 가져오는 데 사용되는 클래스입니다. 원격 카탈로그는 IAP 백엔드에서 얻습니다. |
| IAP와의 커뮤니케이션을 위한 시작점입니다. 다음 서비스가 필요합니다.
|
| 이것은 |
| 이 식별자는 |
원격 카탈로그 가져오기 예제 스크립트
다음 예제 스크립트를 참고하십시오.using System.Collections.Generic;using System.Threading.Tasks;using UnityEngine;using UnityEngine.Purchasing;public class PurchaseManager : MonoBehaviour{ StoreController m_StoreController; // Called by the ServiceOrchestrator after Auth is complete public async Task InitializeIAP() { m_StoreController = UnityIAPServices.StoreController(PaymentProvider.Name); m_StoreController.OnPurchasePending += OnPurchasePending; await m_StoreController.Connect(); m_StoreController.OnProductsFetched += OnProductsFetched; // 1. RemoteCatalogProvider 초기화 RemoteCatalogProvider catalogProvider = new RemoteCatalogProvider(); // 2. 결제 제공업체에 대해 명시적으로 카탈로그를 가져옵니다. var fetchRemoteCatalogResult = await catalogProvider.FetchRemoteCatalog(); if (!fetchRemoteCatalogResult.Success) fetchRemoteCatalogResult.Exception!;을 발생시킵니다. // 3. 원격 정의를 StoreController에 전달합니다. var productDefinitions = catalogProvider.GetProducts(); m_StoreController.FetchProducts(productDefinitions); } private void OnPurchasePending(PendingOrder 순서) { // Handle purchase validation and rewarding before confirming the order Debug.Log($"Order pending: {order.Info}"); } void OnProductsFetched(List<Product> products) { // Handle fetched products (e.g., populate UI) Debug.Log("Fetched products:"); foreach(제품의 각 제품) { Foreach (produ.catalogListings.Values의 var catalogListing) { Debug.Log($"ID: {catalogListing.definition.id} - Price: {catalogListing.metadata.localizedPriceString}"); } } }}