【发布时间】:2022-02-28 09:21:55
【问题描述】:
有人知道我为什么会收到这个错误吗?这是在将我的项目升级到新版本的 Unity3d 后显示的。
错误 CS0103:名称 `Array' 在当前上下文中不存在
#if IAP && UNITY_PURCHASING
private void OnItemPurchased(IAPItem item, int index)
{
// A consumable product has been purchased by this user.
if (item.productType == PType.Consumable)
{
CurrencyController.CreditBalance(item.value);
Toast.instance.ShowMessage("Your purchase is successful");
CUtils.SetBuyItem();
if(Array.IndexOf(Purchaser.instance.iapItems, item) >= 1)
{
CUtils.SetRemoveAds(true);
}
}
// Or ... a non-consumable product has been purchased by this user.
else if (item.productType == PType.NonConsumable)
{
// TODO: The non-consumable item has been successfully purchased, grant this item to the player.
}
// Or ... a subscription product has been purchased by this user.
else if (item.productType == PType.Subscription)
{
// TODO: The subscription item has been successfully purchased, grant this to the player.
}
}
#endif
【问题讨论】:
-
您可能缺少“使用”指令。
-
正如船长Crazy所说,检查你是否有
using System;。 -
谢谢大家修复。
-
遇到了同样的问题,感谢修复!