Need a way for a spawner object to pass itself to the spawned object...

So first I’ll need to describe what I’m trying to get to happen.

I have a spawner object that spawns cubes in intervals that travel downward. If the cubes hit the floor then the floor gets destroyed, along with the cube, and I need to also turn off the spawner so more cubes aren’t spawned.


So what I need help with is how to reference the particular spawner that’s ABOVE the floor(there will be multiple floor and spawner objects). If I can do that when either the cube collides with the floor, they can turn the spawner off. Or, before the floor is destroyed, it can tell the spawner to turn itself off.

This is what I’ve tried in my ignorance :


The cube spawns inside of the spawner and travels downward, so I thought that using an end overlap with the spawner could pass a reference to itself there. But that doesn’t work, it doesn’t even print the hello. Yes I’ve checked that generate overlap is checked.

I was also thinking that I could reference it in the floor, but I would need a way to maybe… scan for objects on the Z axis to find out which spawner belongs to which floor. I’m not sure how to do that.

If anyone is willing to offer me any advice or possible solution I’d be very grateful.

If you create an array with all your spawners and add an integer variable set with the value of the index where is registered the spawner in the array.
If the spawned refers to the same spawner, Add this variable in spawned too when you spawn it and on event check this value with your array, you’ll have your spawner.
If spawned can lateraly move, do the same with floor instead of spawned.

Hmmm… I kind of see where you’re going. Where would I store the array and the variable? In the level blueprint?

You can set array in level before play and variables in both spawner and spawned, but as writing i realise that if your spawner is always the one which spawns the spawned, you don’t need it, just create a variable “spawner blueprint” and set it with the spawner directly on spawn.

I don’t really understand what you’re trying to say. Sorry. X |

Can anyone offer any other possible solutions please?

Try to do that :
The type of the variable spawner is actor. Don’t forget to click the eye and set tooltip or you can’t see it in spawner bp.

I finally got around to working on it, and your solution helped me very much. Thank you, Fen. :smiley: