It would be nice if you could add a BP node with the same functionality as the Remove Index or Remove Item array nodes, except that it also has a bool for keeping the array the same size. It would be something like the opposite of Set Array Elem node, which can resize the array to fit the added index.
The problem is that if you have some functions relying upon an array’s carefully sorted indexed items, removing an item ruins that structure.
Example: I have carefully added 5 elements in this order with corresponding indices: Wind, Water, Fire, Earth
I also have a selection system implemented and my currently selected item(which is an int) is Water and my previously selected item(which is also an int) is Fire.
Now I want to remove Water from my array and update the currently selected item to my previously selected item Fire, BUT because removing an item from an array all remaining index numbers will update to close the gap, I will now have Fire on index 1, instead of index 2, where I carefully placed it.
I hope someone sees this and understands the need for it. It’s pretty much the same opposite as Set Array Elem node with the “Size to fit” bool.
I think you misunderstand what the keep same size array boolean does. It simply ensures that if the array were to cross the threshold that the engine would want to resize the amount of allocated memory for the array, that it will not. It does not mean that the indices for the items in the array will remain the same.
It very much depends on what the types of the elements are in your array, but assuming they are objects of a form, instead of using Remove you should use Set and assign a None in to that slot to maintain your spacing.
I’m doing this but when loading the level again some unpredictable things happen, like loading the element I set to none and another element that I didn’t set to none disapears from my level, any hint?