[System.Serializable]
public class PlayerData {
public List<Item> inventory;
public float maxWeight = 200;
public float currentWeight;
}
public PlayerData playerData;
void InvGui () {
GUI.Label(new Rect(375, 50, 500, 50), "Weight: " + playerData.currentWeight.ToString() + "/" + playerData.maxWeight.ToString());
if(GUI.Button (new Rect(100, 100, 55, 55), "Helm: ")){
}
for (int i = 0; i < playerData.inventory.Count; i++) {
GUI.Label(new Rect(375, i * 55 + 100, 200, 55), playerData.inventory[i].ItemName + " x" + playerData.inventory[i].Quantity.ToString() + ", Weight: " + playerData.inventory[i].totalWeight.ToString());
if (GUI.Button (new Rect (300, i * 55 + 100, 55, 55), playerData.inventory [i].ItemIcon)) {
playerData.inventory.RemoveAt (i);
}
}
}
The problem with this script is it only gives a single line for the inventory GUI icons. how to make this multi row?