【问题标题】:The name `Array' does not exist in the current context当前上下文中不存在名称“数组”
【发布时间】: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;
  • 谢谢大家修复。
  • 遇到了同样的问题,感谢修复!

标签: c# unity3d


【解决方案1】:

聚会迟到了,但我想添加一个官方答案。

正如 cmets 中的多个人所建议的那样,您可能缺少 using 指令。更具体地说是using System;

希望这有助于未来的程序员更快地找到解决方案。

【讨论】:

    猜你喜欢
    • 2013-10-02
    • 2014-04-22
    • 2017-06-17
    • 2015-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-18
    相关资源
    最近更新 更多