Destroy Object

I’m making a player command for a top down game that spawns an object in front of the player I’m experiencing two problems with it:

  1. I want the object to be destroyed after 3 seconds or after releasing the command key. When I wait and the object gets destroyed an error pops up after exiting the game.
  2. I’m trying to get the object to follow me as I move around does anyone have any ideas

Try this:

  • in the actor being spawned:

  • in the player:

  • you can promote return values to variables like so:

image

  • and right clicking actor get nodes can convert them to their validated variants:

1 Like

What are the function names for set spawned object and get is Valid from cause I can’t find them?

The last 2 screenshots explain it. Right click the pins / nodes. It’s a variable that you can name yourself - I named it SpawnedObject.

Consider naming it in a more meaningful fashion, like aProtectionShield or aAttackDrone, whatever it’s supposed to do.

I tried your suggestion for destroying an actor but it doesn’t work the spawned object still stays there until the end of the object’s lifespan it’s possible that we’re using different versions of unreal. Mines 5.0.3 for reference.

Nevermind you were right