Closed Donahuec closed 7 years ago
@cpimhoff You definitely have valid points. The reason I opted for this implementation was because I didn't like having null values that purely come from our custom inspector stuff ever being passed back into the actual interaction (basically I don't like having the interaction have to worry about quirks from the custom inspector). I agree though that it is a bit convoluted (maybe more-so than it felt when I was implementing it). We should discuss these design choices in our meeting today, and I will adjust the implementation tonight based off of what we decide.
Deleting this pull request and branch
This PR is addressing issue #144
A method as been added to PrairieGUI that removes any null values from an array.
When a custom editor wants to use our custom-list-drawing method, instead of writing directly to the object's array, instead there should be an intermediate variable in the editor script to store the value. Then any null values should be removed before passing that value back to the object. This allows the editor to have empty spaces to be drawn, but prevents those null values from being pushed back to the object and causing errors.
To make sure that the editor list is not empty when reloading (say after testing the game) a quick check at the beginning of OnInspectorGUI needs to be done to see if the array is currently empty, and if it is set it to the value of the object's array.
This seems a little complicated, but it is necessary to work around the set size of arrays.