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; }