From 8e2b78a385e186a653fb71a858919cb1ff269199 Mon Sep 17 00:00:00 2001 From: huyfei Date: Mon, 22 Jan 2024 15:15:26 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BF=AE=E5=A4=8D=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=97=AE=E9=A2=98,=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs b/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs index 9f2fa27..87c023f 100644 --- a/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs +++ b/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs @@ -324,17 +324,25 @@ namespace Guru } } + /// + /// 获取 IAP 内置商品 + /// + /// + /// public Product GetProduct(string productName) { - if (_storeController != null || _storeController.products != null) + if (_storeController != null && _storeController.products != null) { var info = GetInfo(productName); if (info != null) { return _storeController.products.WithID(info.Id); } + Debug.LogError($"[IAP] --- can't find with name {productName}"); } - + + // 商品不存在则返回 NULL + Debug.LogError($"[IAP] --- _storeController is null or products is null or products.all.Length == 0"); return null; }