Here is the code in question:
public List- craftingItems = new List
- ();
public void checkIfItemIsCraftable(){
for (int i = 0; i < inv.database.craftingDatabase.Count; i++) {
for (int x = 0; i < craftingItems.Count; x++) {
if (craftingItems [x].ID == inv.database.craftingDatabase [i] ["craft"] ["itemID_1"] || craftingItems [x].ID == inv.database.craftingDatabase [i] ["craft"] ["itemID_2"]) {
if (craftingItems [x].ID == inv.database.craftingDatabase [i] ["craft"] ["itemID_1"] || craftingItems [x].ID == inv.database.craftingDatabase [i] ["craft"] ["itemID_2"]) {
Debug.Log (inv.database.craftingDatabase [i].Name);
}
}
}
}
}
Very sloppy I know but its because I'm just trying to figure something out. I am these errors:
> Assets/Scripts/ItemCrafting.cs(40,68):> error CS0021: Cannot apply indexing> with [] to an expression of type> \`Item'.>> Assets/Scripts/ItemCrafting.cs(41,67):> error CS0021: Cannot apply indexing> with [] to an expression of type> `Item'.
I have looped through many variations of the the same type of List before but for some reason this one will not work. I have no idea if I am overlooking something but its gotten to the point were I just can't figure it out. If someone could shine some light on this I would greatly appreciate it!
Thank you.
↧