|
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
(comments are locked)
|
|
For anyone else who is searching for the solution to this, here is working code in Javascript. It doesn't look the same as the built-in array controls, but it works fine. you made my day.. thanx!
Apr 01 '11 at 10:26 PM
cupsster
(comments are locked)
|
|
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 Thanks man! Almost the same as the default inspector! You saved my day. Now I need to figure out what each method does...
Dec 20 '12 at 07:23 AM
mepine
(comments are locked)
|
|
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.
(comments are locked)
|


your kinda vague, if your asking how to take a built in array with some array indexes empty, and resize it to not have those empty slots, i went through each index in your array(array A, looks like your using a built in array, idk i use JS), asked if its not empty (if !=null), then put it in another array (array B, i used a JS array), then make array A = array B(if JS array, A=B.ToBuiltin(var type(for you, Transform)).
please clarify your question if i have not already answered it.