# Item spawn array help

**URL:** <https://forums.unrealengine.com/t/item-spawn-array-help/2654603>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [September 7, 2025, 10:16pm UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603 "2025-09-07T22:16:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parklis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Parklis](https://forums.unrealengine.com/u/Parklis)\
**Post date:** [September 7, 2025, 10:16pm UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/1 "2025-09-07T22:16:54Z")

</div>

I have an event in the level BP that spawns a item in one of X preset locations (SpawnLocations). From BeginPlay, a CustomEvent gets all actors from the SpawnLocations and spawns a BOX in one of them.

From lvl\_BP

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/1/7a14ddfc53594082955580975a7c57efed43bec3.png)

There is an interaction with the BP\_Box that allows me to destroy it and have a dispatch that lets the level know to do it again.

From BP\_Box:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/5/a8528cfcfd1e6e4580666d90ebd594ee141935ed.png)

From lvl\_BP:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/d/38d95445377ed78d98a69056b398ffb53168e105.png)

All of this works properly, however I am trying to make sure it doesn’t spawn in the same place twice in a row. It can spawn multiple times but I do not want it to do it back-to-back. Any help or ideas how to do this would be great

---

<div class="post-metadata">

**Author:** ![doctorpepperdan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@doctorpepperdan](https://forums.unrealengine.com/u/doctorpepperdan)\
**Post date:** [September 7, 2025, 10:44pm UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/2 "2025-09-07T22:44:06Z")

</div>

Create an array of the item spawn locations, whe one is selected to have an item spawned, add that to the array. Then in the event for selecting a new location, query that array for the selected location, if it is there, select a new location. Alternately, you could preload the array with all the locations, select random every time an item is spawned, and remove that index.

---

<div class="post-metadata">

**Author:** ![Parklis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Parklis](https://forums.unrealengine.com/u/Parklis)\
**Post date:** [September 7, 2025, 10:58pm UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/3 "2025-09-07T22:58:12Z")

</div>

How could I create an array that stores them? I am still pretty new at this and am self teaching / VOD taught game dev, so sorry for what might be basic questions.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [September 8, 2025, 12:45am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/4 "2025-09-08T00:45:19Z")

</div>

The dispatcher event can pass a reference to exclude. That’s the easiest and most performant route.

---

<div class="post-metadata">

**Author:** ![Parklis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Parklis](https://forums.unrealengine.com/u/Parklis)\
**Post date:** [September 8, 2025, 12:53am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/5 "2025-09-08T00:53:48Z")

</div>

Sorry to bother you about this, but how would I do that? This is my frist time trying dispatchers.

---

<div class="post-metadata">

**Author:** ![doctorpepperdan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@doctorpepperdan](https://forums.unrealengine.com/u/doctorpepperdan)\
**Post date:** [September 8, 2025, 1:23am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/6 "2025-09-08T01:23:24Z")

</div>

You’d set a variable in the BP. Or better yet, if this level will be persistent throughout play, you could just destroy the box spawn location actor after spawning the box in its location. That would probably be the best way performance/memory wise to accomplish this. This way when you call “get all actors" it won’t be found. Thus removing the need for an array and other query functionality.

Update: it looks like your already doing this but then respawning an actor? Why not just leave it destroyed? That would fix your issue.

Question: are these “locations” preset variables in the level BP? Or actors in the world you have placed? Just wanting to make sure I understand exactly what’s being done here.

---

<div class="post-metadata">

**Author:** ![Parklis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Parklis](https://forums.unrealengine.com/u/Parklis)\
**Post date:** [September 8, 2025, 1:33am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/7 "2025-09-08T01:33:25Z")

</div>

I want the ability to spawn it in that location again, just not twice in a row. However, now that I am thinking about it, I like your way. I might try that

the Spawn Locations are actors I am have placed

---

<div class="post-metadata">

**Author:** ![doctorpepperdan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@doctorpepperdan](https://forums.unrealengine.com/u/doctorpepperdan)\
**Post date:** [September 8, 2025, 1:38am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/8 "2025-09-08T01:38:24Z")

</div>

Got it so what you could do is set a variable in the level BP of a reference to that actor object type. Every time a location is selected, set that variable to it. On the next round of selection, exclude that from the “get all actors” then set that variable to the new selected actor. This way the location can be reused but won’t be selected twice in a row

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [September 8, 2025, 1:49am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/9 "2025-09-08T01:49:44Z")

</div>

**BP\_BOX**

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/5/1657e61f7c355f3962232779f20ff2bdaa50e915.png)

**Level BP**

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/9/5/195d897816876395dda98536e8a5dc2f3a596a7a.jpeg)

**Create Box**  
Excludes last used area.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/9/ce90e233f331fe9ff43801aa60ab44875512060f.png)

---

<div class="post-metadata">

**Author:** ![Parklis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Parklis](https://forums.unrealengine.com/u/Parklis)\
**Post date:** [September 8, 2025, 4:40am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/10 "2025-09-08T04:40:43Z")

</div>

Thank you all for your help. I tried everyones suggestions and decided it would play better if I just destroyed the SpawnLocation actor the box is being created to. I set the index object as a VAR and the call it to destroy it after the dispatch event. Keeps it so the location can’t be spawned again and I can make it work my idea.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/7/ff7ab1c50c15df73f69ec167dd5f2d5d052b89bc.png)

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [September 8, 2025, 5:28am UTC](https://forums.unrealengine.com/t/item-spawn-array-help/2654603/11 "2025-09-08T05:28:16Z")

</div>

random thought. i would make it so that “create box” returns the created box. getactorofclass might return something else if there are two boxes.

also i’d personally make it so that the spawn locations spawn the actors. not the level bp. but i haven’t thought it up in detail.
