# Array: spawn an item, delete the item spawned and if no items left, re-enable the array?

**URL:** <https://forums.unrealengine.com/t/array-spawn-an-item-delete-the-item-spawned-and-if-no-items-left-re-enable-the-array/483194>\
**Category:** World Creation\
**Tags:** spawn, array-nodes, random, randomize-array, spawn-rate, unreal-engine, question\
**Created:** [May 10, 2021, 9:19pm UTC](https://forums.unrealengine.com/t/array-spawn-an-item-delete-the-item-spawned-and-if-no-items-left-re-enable-the-array/483194 "2021-05-10T21:19:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ululele12](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ululele12](https://forums.unrealengine.com/u/Ululele12)\
**Post date:** [May 10, 2021, 9:19pm UTC](https://forums.unrealengine.com/t/array-spawn-an-item-delete-the-item-spawned-and-if-no-items-left-re-enable-the-array/483194/1 "2021-05-10T21:19:37Z")

</div>

Hey, folks! I have a very specific idea regarding the level streaming in my project. I want to have the following function:

an array of levels that I want to make visible at random, and I do not want them to reappear until the one cycle of the array making my levels visible ended. I know that I can delete my indices after each loop, but is there a way to reset the array to its initial state?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 11, 2021, 8:43am UTC](https://forums.unrealengine.com/t/array-spawn-an-item-delete-the-item-spawned-and-if-no-items-left-re-enable-the-array/483194/2 "2021-05-11T08:43:42Z")

</div>

Have two arrays. One holds the levels, the other is a copy which you shuffle and use. When you’re done, just copy the original across again.

BTW: Only ever remove the last index, otherwise looping will not work…

---

<div class="post-metadata">

**Author:** ![Ululele12](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ululele12](https://forums.unrealengine.com/u/Ululele12)\
**Post date:** [May 12, 2021, 5:05pm UTC](https://forums.unrealengine.com/t/array-spawn-an-item-delete-the-item-spawned-and-if-no-items-left-re-enable-the-array/483194/3 "2021-05-12T17:05:08Z")

</div>

Thank you so much, sir! You’ve helped me immensely! Didn’t expect anyone to help me with this particular question. Now I have a small related question - is there a way to easily copy all items of one array to another? I’ve been searching for an easy solution, but haven’t found one.

 ![338626-image-2021-05-12-20-02-02.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/1/e71897f617c454d785b8860a380b0e6064a7154c.png)
