I figured out the problem, and it has to do with the way that the serializer works with default constructors. I was able to make the array have the correct length in two ways: 1) by marking each field with a NonSerializableAttribute (which was not ideal because at the very least I want users to be able to modify the class from the Inspector), and 2) by not having a default constructor with the AddToStaticArray() method. Even when I wasn't using the default constructor to initialize my fields, the serializer was calling it multiple times, apparently. So, since I wanted to keep serialization, I decided to forego the default constructor.
↧