I am sure that inventoryItem.Name contains "Wood" cause i see it when i add a breakpoint. Still i get nothing in the game. Just empty buttons.
void DrawInventoryContent (int id)
{
var buttonIndex = 0;
var x = 0;
var y = 0;
foreach (var item in inventoryItems) {
//create position rectangel for button
var startMargin = buttonMargin;
var leftStartPosition = startMargin + buttonMargin * x + buttonWidth * x;
var topStartPosition = startMargin + buttonMargin * y + buttonHeight * y;
var buttonRectangel = new Rect (leftStartPosition, topStartPosition, buttonWidth, buttonHeight);
//Get inventoryiten by index
var inventoryItem = inventoryItems [buttonIndex];
var name = inventoryItem.Name;
//Create and place buttin
GUI.Button (buttonRectangel, name);
// check if this button is at end of row and change to next row
if (x == buttonsPerRow - 1) {
x = 0;
y++;
} else {
x++;
}
//go to next item
buttonIndex ++;
}
}