Hi.
Is there any way to remove item from array without reindexing the array?
[0]A
[1]B → remove
[2]C
Result:
this is what I need.
[0]A
[2]C
this is what I have.
[0]A
[1]C
Hi.
Is there any way to remove item from array without reindexing the array?
[0]A
[1]B → remove
[2]C
Result:
this is what I need.
[0]A
[2]C
this is what I have.
[0]A
[1]C
No. But you could set the item at [1] to some invalid state, such as null, or if it’s a struct instead of a class, a bool variable that can be set to indicate it’s not valid. C++ (and most other languages that use contiguous arrays) have the same limitation.
thx. It seems like i need to reindex all objects which refer that indexes. Otherwise this array will grow up to thousands of empty elements
I Don’t know how allocation works on this, but you might try using
TMap<int32,SomeTypeYouUse>
TMap it a map that uses custom index, index in TMap need to be stored to so you can use any index and you wont have empty elements
Problem with TMap is that it not supported by reflection system so you need to memory manage it