I have an inventory in my game which currently is an array of items, a serializable plain c# class. Checking if there's a free spot in the inventory loops through the array and compares array[i] == null. This works until I clicked on the gameObject to view the array in inspector. I forgot the inspector creates the Item instead of letting it be null, and it uses the default ctor. this leads to a few logic errors.
Is there any simple way I can still view my list of items in inspector but allow elements to be null? I'm wondering if theres a common workaround for this sort of thing since id rather not change the Item logic purely for viewing it in inspector.
This is a small example to reproduce this with. https://paste.mod.gg/kpuyveeycssy/0. The logs will change from 10 being null to 0 as soon as you click the object to see it in inspector