- Home /
Is there a way to remove array entries in the editor?
Not in code, but in the editor window. For example, suppose I have a frame-by-frame sprite animation, but then I want to remove a frame from the middle. Just in the editor (i.e. no scripting), how can I do that? If this is not possible, is it something that might be considered? I think there are clear applications for being able to edit an array by moving entries around, copying entries, deleting entries, etc.
Answer by thelackey3326 · Jun 26, 2015 at 09:14 PM
If you have an array of items in the Inspector and want to delete an entry from the middle of the array, you can select the item (click on its name, it should turn blue) and then do a Shift-Delete. The item should be gone then, and your array size will decrement.
See this link http://blog.almostlogical.com/2011/12/19/unity-editor-lesser-known-features/
Heads up, though! It says you have to do Shift-Delete twice, but that isn't actually correct.
Answer by malkere · May 20, 2019 at 06:05 AM
Nowadays you can right-click on them and delete them to resize the array, but shift-delete does not seem to work. Would be really nice to have a keyboard shortcut.
You can select one then hit delete to clear it and use the up and down arrow to move around and continue deleting. Then you can right-click, up arrow, and delete to clear an entry. That let me clear/cleanup a big messy array pretty fast without having to reset it.
Answer by robertbu · Feb 24, 2013 at 06:20 AM
You can shorten it, but you cannot remove an entry in the middle. You can write an editor script that manipulates an specific array including deleting or inserting in the middle.
Watch out if you're "referencing" them somewhere else.
For example, for animations you might store all possible frames in one array, then make another array for an animation that references the frames array. The animation array reads "1, 2, 3, 10, 3, 2, 1". Later on, you remove frame #9. Frame #10 is moved to #9. The animation would now be using the old frame #11 in place of #10 if you didn't update it.
Answer by WSAGAMERS · Jun 07, 2021 at 09:38 AM
Just Right-Click on Array Item from Inspector and Select Delete Array Element.
Your answer
Follow this Question
Related Questions
Problem with arrays in a list 1 Answer
How can you do calculations on two lists? 1 Answer
Reading all data in the list with duplicate data inside 1 Answer
Undo/back system using a List/Array 2 Answers
How to modify array values? 1 Answer