Hi. I wanted to ask is there a way to spawn in an actor and after destroying it spawn it back after some time? I’ve tried delay, timer by function (in functions and event graph), but they just don’t seem to work. The actor is not spawning in no matter how I change the blueprints. I’m trying to create a harvesting system for a rock that after the rock has been collected/destroyed it should spawn back after some time and it can be harvested again and the process repeats itself. Im quite new to unreal engine and I wanted to know if its even possbile. All anwsers are welcomed.
Hey @MangoPenguin2601! Welcome to the forums!
So when an actor is destroyed, it is removed from the scene. Therefore, you can’t have anything in the code on that actor after that point, because it’s gone
What I would suggest is:
Either:
Hide the actor and make it noninteractable for a set time, then unhide it and make it interactable again after the timer.
Or
Put the code in the level blueprint, and tell it to spawn one of these actors at X,Y,Z when you want it to.
Just to build on what Mind-Brain is recommending…
…I would suggest another actor, or level BP per Mind-Brain, of which that “thing” is responsible for spawning new rocks. That would be my recommendation; however, I am not fully burdened by how your game is intended to operate.
Anyway, could pass a reference to the spawned rock of the “thing” that created it.
Could have some “Dying” event in the rock actor which in addition to destroying that rock actor it makes an event call back to the “thing” that created it. This callback could be an event in that “thing” which when called it would, say, waits ‘x’ seconds and then spawn another rock of which the calling/connecting cycle would repeat.
In my mind the rock actor should do rock actor things. The other actor, or level, would be responsible for how that rock actor appears, and reappears (say a rock spawner actor which would have rock spawning responsibilities).
Ty for your suggestion I tried it and it worked! I tried the level blueprint version and i added my coded there, changed it a little and boom I got it running. Thank you for the help:)