string on GUI.Button not showned

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 ++;

        }
}

You might have a counter to determine how many buttons you have already placed in a vertical or horizontal layout. Here’s an example of a way to layout a series of columns of buttons that break each column after a certain number.

		int itemCount = 0;
		GUILayout.BeginHorizontal();

		GUILayout.FlexibleSpace();

		GUILayout.BeginVertical();

		foreach(ItemType item in inventoryItems)
		{
			
			if(GUILayout.Button(item.name))
			{
				// etc
			}

			GUILayout.Space(20);

			itemCount++;

			if(2 == itemCount)
			{
				itemCount = 0;
				GUILayout.EndVertical();
				GUILayout.BeginVertical();
			}

		}
		GUILayout.EndVertical();

		GUILayout.FlexibleSpace();

		GUILayout.EndHorizontal();

I solved it. It was nothing to do with this code.
InventoryItems was a list but was poulated with SpaceWood that derives from InventoryItems. This made the data show up while debug stepping but not showing in the game.

Sorry for taking your time!!!