# Making a UI widget display when actor is destroyed

**URL:** <https://forums.unrealengine.com/t/making-a-ui-widget-display-when-actor-is-destroyed/443270>\
**Category:** Blueprint\
**Tags:** Destroy-Actor, loading-phase, unreal-engine, Blueprint, CPP, question\
**Created:** [February 12, 2019, 10:38pm UTC](https://forums.unrealengine.com/t/making-a-ui-widget-display-when-actor-is-destroyed/443270 "2019-02-12T22:38:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neonzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Neonzz](https://forums.unrealengine.com/u/Neonzz)\
**Post date:** [February 12, 2019, 10:38pm UTC](https://forums.unrealengine.com/t/making-a-ui-widget-display-when-actor-is-destroyed/443270/1 "2019-02-12T22:38:36Z")

</div>

Hey all,

So for the last hour I’ve been trying to work this out I’ve tried everything I can think of now I’ve used Event Destroyed, Event End Play and Bind Action OnDestroyed if I load the game from a game level everything is good and I don’t get my UI appeir until the actor is destroyed (C++)  
`{  
int32 DamagePoints = FPlatformMath::RoundToInt(DamageAmmount);  
int32 DamageToApply = FMath::Clamp(DamagePoints, 0, CurrentHealth);

```
CurrentHealth -= DamageToApply;

if (CurrentHealth <= 0)
{
	Destroy();
	UE_LOG(LogTemp, Warning, TEXT("Tank Death"))
}

return DamageToApply;

```

}` However when loaded from the main menu screen it instantly appeirs

---

<div class="post-metadata">

**Author:** ![Chyros](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chyros](https://forums.unrealengine.com/u/Chyros)\
**Post date:** [February 13, 2019, 5:32am UTC](https://forums.unrealengine.com/t/making-a-ui-widget-display-when-actor-is-destroyed/443270/2 "2019-02-13T05:32:19Z")

</div>

Sometimes, **Event Destroyed** of many Actors are being called in UE4Editor (not UE4Game) on map/level load even if you don’t use it on a map / level. That’s just how the PIE (Play In Editor) works to refresh the actors in editor.

Try using a a separate custom event (i.e., **OnDeathEvent** ) to put your UI spawn logic. And then on your HealthCheck-like event, if its life goes to 0 (dead) then call the **OnDeathEvent** manually (instead of **Event Destroyed** ).

In addition, if you put **UE\_LOG** to print “Actor Destroyed” in your Actor’s C++ Destructor method, you’ll see many actors being created and destroyed by just playing and exiting from PIE (Play In Editor).
