I've been running into troubles doing this and could use some extra thoughts. Here is the code I have so far.
I have an array stored in a script component named
Essentially, I am getting hung up on the idea of how this works:
How can I get
asked Aug 29 '10 at 11:23 PM
This is roughly what
It works like it should with bold font on prefab overrides etc. It also handles undo operations, 'delete' operations and 'shift+delete' operations as expected. It works with all the kinds of arrays that Unity originally supports. It also looks like the original.
Remember to call
answered Feb 24 '12 at 01:53 PM
To expand on what @Steven Walker posted, Started down this road using the newer List<>. I found that typing things like "-" or leaving a field empty destroys the list (counts as "0" elements), so I wrote this code snip-it in C#. This is just for reference, not a complete solution. I decided it would be more user-friendly to supply +/- buttons per element so things can be inserted or removed. I always hated the default method of just destroying from the end. I might even add up and down buttons just for pure organization use....
Anyway. Here is some code which uses a text field and only changes the size value if an actual number is entered. Also note that this clamps to 0-9 since typing 10 would type a "1" first and destroy the list down to 1 item.
answered Sep 24 '11 at 09:27 PM