mha*_*ruz 9 c# unity-game-engine
有谁知道我为什么会收到这个错误?这在将我的项目升级到新版本的 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
Run Code Online (Sandbox Code Playgroud)
聚会迟到了,但我想添加一个正式的答案。
正如评论中的多个人所建议的那样,您可能遗漏了一条using指令。更具体地说using System;。
希望这有助于未来的程序员更快地找到解决方案。