Best way to display list of attributes and its values ?

Hey there,

I’m just wondering what’s the best way to implement gui to display list of attributes ?
for example: like a character screen with (strength, health, weapon_damage,…etc) , its base values and its bonus values (from items and potions and whatnots).

:slight_smile:

I think you mean characters’s properties by attributes? Not C# Attributes?
There are a lot of ways you can show them - as text values with GUL.Label() (as in example bellow), or as healthbar with GUI.Texture(), or even as horizontal scrollbar…

Here is a simple example of GUI.Label:

[SerializeField]
List<MyCharacterAttribute> attributes;

void OnGUI()
{
	for(int i = 0; i < attributes.Count; i++)
	{
		DrawAttrubute(i, 30, attribute.Name, attribute.Value);
	}
}

void DrawAttrubute(i, 30, attribute.Name, attribute.Value)
{
	GUI.Label(new Rect(10, 30*i, string.format("{0} - {1}", attribute.Name, attribute.Value)));
}
[Serializable]
class MyCharacterAttribute
{
	public string Name;
	public string Value;
}

thanks for quick answer :slight_smile:
yes, I was looking for a simple solution to store the attributes in a list/dictionary/array and then simply display them

thxx!