I'm having a problem figuring out how to display my object's stats that are not equal to 0. Basically I have an Item class that contains 50+ variables like strength, agility, intelligence, etc... all defaulted to equal 0. Every time I click a button, it generates an object and gives some of the object's attributes non-zero values (aka strength is now 3, agility is now 2, everything else stays 0).
In my GUI script, upon clicking the generated item I wanted it to display the item's details. I just want it to display the object's attributes if they were not 0. That way I don't have 50+ lines of attributes on the item saying it's just of value 0.
A snippet of the item's details is below(Note it compiles and runs fine):
public void LootDetailWindow(int id)
{
GUI.Label(new Rect(10, 15, 150, 80), "<color=white><size=15>" + item.Name + "</size></color>");
GUI.Label(new Rect (10, 50, 100, 100), item.Icon);
GUI.Label (new Rect (150, 50, 200, 100), "Level Requirement: " + item.Reqlvl.ToString() + "\nSell Value: " + item.Value);
//here I want to create a label that for every value that is not 0, to display it.
}
So how would I go about going through each attribute and checking to see if it's 0? Thanks in advance.