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.