How to play a particle effect on actor event Destroyed?

I’m following the Battery Collector playlist and decided to play around a little before continuing. So I set my APickup to destroy itself after a set time, by calling a DestroyPickup() function which:

  1. calls a BlueprintImplementable function called PickupExpirationEffect (check screenshot), and then
  2. Destroy() the APickup.

What I want to do is that before the pickup is destroyed, it will play an effect. But the way my blueprint is currently set up, it doesn’t do anything. Once the pickup expires it simply disappears, no effect playing whatsoever. I tried the Event Destroyed from Blueprint itself but nothing happens. As in the screenshot, connecting either Event Destroyed or Event Pickup Expiration Effect makes nothing happen in the level, the pickup is simply gone.

I’m still very, VERY new to UE4, so please help me! This is the Event Graph of the pickup’s blueprint.


Well, you have to call the spawn emitter BEFORE you destroy the actor, as once it is destroyed… how will you get it’s location? It doesnt exist anymore.

Alternatively, In the function you use to destroy the actor, you could store a variable with it’s current location and spawn the emitter at that location.

That’s what I don’t understand. I have tried wiring PickupExpirationEffect to the SpawnEmitter node before, but it doesn’t make anything happen, that’s why I tried Event Destroyed, to no avail.

Here is my code.

Timer, in BeginPlay()

PickupExpirationEffect in Pickup.h:




Current blueprint:

As the C++ code of DestroyPickup says, PickupExpirationEffect is supposed to run before Destroy() is called. Yet nothing happens at all.

Oh my God silly me! I was tweaking the Pickup class while expecting the Battery class to play the effect! I thought tweaking the parent blueprint would trickle down to the inheriting blueprints! ■■■■ everything is playing nicely now!

its always something little that trips us up in UE4 :slight_smile: