# Game Over on destroy all actors

**URL:** <https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [August 28, 2020, 6:04pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471 "2020-08-28T18:04:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_451ef1c5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_451ef1c5](https://forums.unrealengine.com/u/anonymous_user_451ef1c5)\
**Post date:** [August 28, 2020, 6:04pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/1 "2020-08-28T18:04:06Z")

</div>

Hello. I wondering how to display Game Over widget but only when all 5 actors have been destroyed.  
This imported static mash actor has NO overlap destroy actor in it however when it hits the cube it will destroy itself because of Destroy Other Actor is checked in the cube blueprint. Maybe I need to create blueprint for my 5 actors.  
This actor has 4 other copies of itself though. Even if I have to create 5 different blueprints for those actors how would I go about letting UE know that all of the 5 actors have been destroyed and show Game Over widget? Either way, thanks for your much-needed help!!!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 28, 2020, 6:27pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/2 "2020-08-28T18:27:32Z")

</div>

You can do it in the level BP:

 ![311701-levelbp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/d/60d8e3498f11105f8b5485504e68566d33c81655.jpeg)

You might have to set the test to something other than 0, remember the floor is probably also a static mesh actor…

---

<div class="post-metadata">

**Author:** ![Okarii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Okarii](https://forums.unrealengine.com/u/Okarii)\
**Post date:** [August 28, 2020, 8:21pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/3 "2020-08-28T20:21:05Z")

</div>

This is were a custom gamemode BP would be extremely useful.  
if you makes a parent class labeled something like “GameplayCounted” that parent class can have two actions on event begin play, and event destroyed.

![311704-destroyed.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/b/1eb1537daa3952814fa9474ed37a4ebc535bb63f.png)

those actions being:

on eventbeginplay - tell gamemode BP to add 1 to some float value that tracks existing important actors.  
on event destroyed - tell gamemode bp to subtract 1 from that float value and check if its 0. if it is, game over.

by using this “gameplayCounted” as a parent then, you don’t have to make any changes to anything new you add or create, it will inherit this functionality from the gameplayCounted blueprint.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 28, 2020, 9:24pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/4 "2020-08-28T21:24:05Z")

</div>

Since you’re already using a _Destroy_ event, this would be fairly efficient and straighforward:

 ![311713-destr.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/e/d1e163761254dd819ffec9c58332e45116bf4b02.jpeg)

You only _Get All_ once and simply count down as they get destroyed. This can be put anywhere, outside of the actor that you’re counting, ofc.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 28, 2020, 9:24pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/5 "2020-08-28T21:24:25Z")

</div>

Why would your track it with floats? You meant integers, surely.

---

<div class="post-metadata">

**Author:** ![Okarii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Okarii](https://forums.unrealengine.com/u/Okarii)\
**Post date:** [August 28, 2020, 9:26pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/6 "2020-08-28T21:26:12Z")

</div>

Yes, integer. My mistake.

---

<div class="post-metadata">

**Author:** ![Okarii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Okarii](https://forums.unrealengine.com/u/Okarii)\
**Post date:** [August 28, 2020, 9:29pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/7 "2020-08-28T21:29:00Z")

</div>

Interesting, is this a form of an event dispatcher? I’ve only ever used custom event dispatches.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 28, 2020, 9:47pm UTC](https://forums.unrealengine.com/t/game-over-on-destroy-all-actors/470471/8 "2020-08-28T21:47:04Z")

</div>

> Interesting, is this a form of an  
> event dispatcher?

Yes! Actors come with a ton of dispatchers by default:

![311714-annotation-2020-08-28-224353.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/1/ab16ff7f128bc0696224b95cee9f781e610f5155.jpeg)

So do components (and pretty much _everything_ else!):

![311715-annotation-2020-08-28-224333.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/b/c7ba0a4a80e6c7df122f2c4038136a46ef52915f.jpeg)

All of the above are boundable (bindable?) delegates.

You will need a custom dispatcher if you need to send specific data. If you’re OK with just an actor reference in _onDestroyed_, it’s OK. But if you need more data from the actor, you’ll do as you do - add a custom dispatcher.
