Hello. How to delete one random object on the map, I delete everything at once
This code doesn’t seem to have any errors that would make it grab more than one object. Things that could cause that:
- Maybe your collider is too large, and is overlapping all objects.
- Your objects are actually static mesh instances, and you are deleting the primary actor.
If you could bring us more information, we will be able to help better!
Hope to hear back soon so we can iron this out!
Ah, so it was the first option:
Right now, because you are spawning the garbage within the collider, they are all getting deleted.
Try moving those spawn points out of the range of the sphere collider, or making the sphere collider smaller.
You said you wanted random trash earlier, can you elaborate on that? What is it you’re trying to do more specifically, and why? What’s the use case so we can figure out the best way?
I need to make it so that when the sphere is turned on for the actor, one spawned garbage object is removed.
Sure thing!
If you just slap a delay on there, you can have them appear one by one with a time difference you determine! ![]()

Ah, well what I gave you was without all of this other information. It looks like in your “Spawn Tree” you have an array of classes called “Tree”. What is this array? This will spawn every listed class in that array, though as it’s labeled singular I’m assuming you just want ONE of them?
What it seems like you’re trying to do here is spawn one tree per interaction. Would that be the case?
Okay, first things first, if it’s just one class right now, let’s take out the “ForEach” just for readability. Minimizing nodes is important, if you need to use an array later you can always re-expand it.
We want to remove anything that may contribute to the issue.
Now, let’s talk about what it is you want. First, there will be trash. When there is an interaction, you want to remove one piece of trash at random, yes? And that’s figured out.
You want the trees to spawn in those same locations, on the object “Spawn Tree” right? So you need something to say “Hey, a tree has already been spawned here.”
So open your SpawnTree Blueprint, and add a Boolean called “IsTreeSpawned?” default set to false. After that we just have to work in checking that bool before adding an item to the array, and setting it once the spawner is used.
Hope this gets it solved for you!
Thanks a lot. everything works perfectly















