Hello everyone :),
Well, this is kinda weird to explain.
So this is the problem,
I have an array in my custom inspector, and I have an intField to set its size, so on every OnInspectorGUI checks if its size has changed and creates the new array, draws it, and so on.
The problem is that, as an example, I have 10 objects, and I want to expand my array to 12, so I enter my intField, and start typing my new value, but suddenly, because the value changed when I press “1”, the value changes, and the array resets to one.
The issue here is that I might not want want to lose the previous array objects, I only wanted to expand them.
My first idea was to implement some sort of ‘Set size’ button, but that seems silly :P.
Then I thought about creating a second array to keep a sort of ‘old’ list, so when it resize, only the new elements in the new array resize will be really ‘new’ (in the previous example, only two of them would be new elements). Its not pretty, but at least the information isn’t lost.
But then I watched that the built in inspector actually changes array size only when enter is pressed on the size field (or when the field loses focus).
Does anyone have an idea of how to implement that kind of functionality?
Thanks a lot,
Italo F. Capasso B. AKA “Edwood Grant”
Edit: I realized there is a forum section only for Unity GUI topics, can please somebody move it there if it does not fit here? Sorry…