Array of Materials not working like Array of Objects

In my game I was able to make an Array of GameObjects, and have it set in inspector, and any functions that called it had no issues. However I’m now working with an Array of Materials, which I’ve set in the inspector. And even something as simple as debugging the Length of the Array shows to be 0, when I know it should be 6.

So I guess my question is, Is there something weird with Materials, or possibly further referencing needed? All examples I’ve searched for this issue aren’t quite like my issue. And I’m wondering, since I’m mainly after just the color anyway, to just switch to Colors instead. But I do feel as though I might wish to change the mats gloss value(or other properties) in the future, so I really would like to figure this out.
Here is a snippet:

public Material[] hairColors; // set in inspector [6]
public Material myHairColor;
protected Renderer hairMaleColor;
protected Renderer hairFemaleColor;

public void SetHairColor()
    {
        int random = Random.Range(0, hairColors.Length); // will be one less = gray hair last for age
        print("array length = " + hairColors.Length);
        myHairColor = hairColors[random];
        if (isFemale) { hairFemaleColor.material = myHairColor; }
        else { hairMaleColor.material = myHairColor; }
    }

^ The error “IndexOutOfRangeException: Index was outside the bounds of the array.” (Which shows from the Array being a Length of 0) happens at myHairColor = hairColors[random];
198142-screenshot-2022-07-29-105034.jpg

@Mokomaki if you could please answer the question as “You more than likely set this into a parent class, instead of a child class that uses it. Because I tested the code and it works just fine”. So that I can give you the credit for finding the answer(technically) :smiley:

Are you sure you set the materials in the inspector not just the size ? I copy/pasted your code and it works fine.