Does anyone know why I'm getting this error? This shows after upgrading my project to the new version of Unity3d.
Error CS0103: The name `Array' does not exist in the current context
#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
Late to the party but I wanted to add an official Answer.
As multiple people in the comments suggested, you are probably missing a using
directive. More specifically using System;
.
Hope this helps future programmers find the solution quicker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With