Hello, I get a null reference exception in the following code:
the variable “itemInstance” is of class Item,
soil inherits from Item.
However, when the code goes to check soil.contents[0] (a member of the inherited class) I get the error.
I’m not sure when this portion of the code runs in your project, but if it checks soil.contents[0] before you set soil equal to something it’ll throw that error.
If it’s not that I think it may be something in itemInstance, perhaps your contents array isn’t being declared/populated or it just doesn’t exist.