How to create an array of GUIStyle and modify values?

var guistyarr_guisty : GUIStyle[];

guistyarr_guisty = new GUIStyle[1];

guistyarr_guisty[0].name = "test";

This does not work and gives the following error message:

NullReferenceException: Object reference not set to an instance of an object

How to create an array of GUIStyle and modify values?

Thanks.

You're almost there

You'll need to loop through the array and assign a new object to each index before attemting to use any item (i.e. right after creating the array)

e.g.

for (var i = 0; i < guistyarr_guisty.Length; ++i)
    guistyarr_guisty *= new GUIStyle();*
*```*