I have an Inventory script with a custom class InventoryItem, which has a bunch of stat modifier variables. At one point in OnGUI I need to loop through an InventoryItem to look at each of its stat modifier variables, and if whatever one it is currently on is greater than zero, display it in the statistics window.
In vanilla javascript I would do something like this:
for(var key in Item){
if(Item[key] > 0){
doSomething();
}
}
But in Unity I get an error: "Type 'InventoryItem' does not support slicing". Is there any way I could accomplish what I'm aiming for?