[SOLVED] Global Variable in C# class seems to be acting like a local variable.

public class ProblemClass : MonoBehaviour
{
//The custom class does not inherit from MonoBehaviour
[SerializeField, HideInInspector]
public CustomClass customClasses;
[HideInInspector]
public int someInt;

     private void OnValidate()
     {
         Initialize();
     }
 
     void Initialize()
     {
         someInt = 10;
 
         customClasses = new CustomClass[6];
 
         for (int i = 0; i < 6; i++)
         {
             customClasses *= new CustomClass();*

}
Debug.Log(someInt);
Debug.Log(customClasses);
}

public void SomeFunctionCalledFromAnExternalScript()
{
Debug.Log(someInt);
Debug.Log(customClasses);
}
}
The above is an abstract and simplified version of my code. The weird thing is that when accessing the variables in the function below after they’d been initialized only the int variable has a value while the Array of the Class is null. I’m new to c# and just can’t explain this behavior. Does anyone know how to get the variable to keeping its value? Removing the Serialization doesn’t make a difference.

I was able to solve the problem: I forgot to add the [System.Serializable] attribute to the CustomClass, which blocked saving…