Acessing array / list from Gizmos in editor

Hi,
I’m trying to access an element of an array / list that is set in the inspector during “editor time” (not playtime).

Bar contains several values in the inspector.

Doesn’t work:

public Bar[] bar = new Bar[2];
OnDrawGizmos() 
{ 
	Method(); 
}

Method() 
{
	print(bar[1].beerBottles);
}

[System.Serialize]
struct Bar 
{
	float beerBottles;
} 

Works:

public float beerBottles;
OnDrawGizmos() 
{ 
	Method(); 
}

Method() 
{
	print(bar[1].beerBottles);
}

How can I make the first option work in the editor? Unity claims that the variable in the first option is null even though the variable is set in the editor.

This code works for me :

using UnityEngine;

public class SerializeAndStuff : MonoBehaviour
{
	public Bar[] bar = new Bar[2];
	private void OnDrawGizmos() 
	{ 
	    Method(); 
	}
	
	private void Method() 
	{
	    print(bar[1].beerBottles);
	}
	
	[System.SerializableAttribute]
	public struct Bar 
	{
	    public float beerBottles;
    }
}

If you want Bar to show up in the inspector, you need to declare it as a class, not a struct.