# Unload Level does not Destroy Actors

**URL:** <https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234>\
**Category:** World Creation\
**Tags:** Destroy, actor, unreal-engine, Physics, level, question\
**Created:** [January 8, 2017, 3:43am UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234 "2017-01-08T03:43:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pelangi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pelangi](https://forums.unrealengine.com/u/Pelangi)\
**Post date:** [January 8, 2017, 3:43am UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/1 "2017-01-08T03:43:36Z")

</div>

I tried to use `UnloadLevel` node in blueprint and call it in my `PlayerController` blueprint. For some reason, every actor made statically (by inserting via Editor), gets destroyed. But all actors dynamically created and spawned in that level, via blueprint, do not get destroyed. Why?

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [January 11, 2017, 3:54pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/2 "2017-01-11T15:54:33Z")

</div>

Hey Pelangi,

Could you do me a favor and double check that the actors that are not being destroyed are definitely part of the level that is being unloaded? Is it possible that these actors are being spawned in the persistent or other level instead of the level that you are unloading?

---

<div class="post-metadata">

**Author:** ![Pelangi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pelangi](https://forums.unrealengine.com/u/Pelangi)\
**Post date:** [January 12, 2017, 1:02pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/3 "2017-01-12T13:02:21Z")

</div>

I’ll try to give the steps as best as I can to replicate this. The target platform is for smartphones.

1. For example, let’s say I have 3 levels: `ParentLevel`, `ChildLevel1`, and `ChildLevel2`.
2. `ParentLevel` is the persistent level.
3. `ChildLevel1` is a sibling of `ChildLevel2`. They both are inside `ParentLevel`.
4. Create a simple custom widget, let’s say `UMyWidget`. Inside it, just add a simple image, via editor, and implement the `OnTouchEnd` event in `UMyWidget` blueprint. Inside `OnTouchEnd`, unload `ChildLevel1` and load stream `ChildLevel2`.
5. In level blueprint for `ParentLevel`, I unload `ChildLevel2` and load stream `ChildLevel1`. It is done inside `BeginPlay` event.
6. Inside `ChildLevel1`, I inserted a simple actor, via Editor, which consist of a single static mesh. Let’s say it is `ABox`.
7. Inside `ABox` blueprint, I implement the `OnInputTouchEnd` event. Inside it, I spawn another actor, let’s say `ABall`.
8. Inside `ABall` blueprint, I implement the `OnInputTouchEnd` event. Inside it, I call `CreateWidget` node to create `UMyWidget` and then call node `AddToViewport`, to put it on the screen.
9. Play the game!
10. Click `ABox` then click `ABall` then click the image inside `UMyWidget`.
11. Notice that `ABall` is not destoryed.

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [January 12, 2017, 3:54pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/4 "2017-01-12T15:54:36Z")

</div>

Thanks for the steps, I’ve found that simply unloading a streamed level with a dynamically spawned actor does not destroy the actor.

I have entered a bug report for this, which you can track here:

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-40515)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

Thanks for your report.

Have a great day

---

<div class="post-metadata">

**Author:** ![Matthew119](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Matthew119](https://forums.unrealengine.com/u/Matthew119)\
**Post date:** [February 18, 2017, 3:58am UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/5 "2017-02-18T03:58:45Z")

</div>

The bug report says that it has been resolved, but I’m still having issues with this bug in 4.14 and 4.15. Is it not fixed yet?

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [February 21, 2017, 2:24pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/6 "2017-02-21T14:24:14Z")

</div>

The bug is marked as By Design. The reason is that spawned actors are in the ‘persistent’ level and will not automatically go away when levels are streamed out.

---

<div class="post-metadata">

**Author:** ![Jiyko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jiyko](https://forums.unrealengine.com/u/Jiyko)\
**Post date:** [June 1, 2017, 1:54pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/7 "2017-06-01T13:54:15Z")

</div>

That’s dev code for they are not going to bother fixing it, I assume, as no one would actually design the system that way.

---

<div class="post-metadata">

**Author:** ![Anonymous\_dd56a58405288d59cf93311503aeeb3e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_dd56a58405288d59cf93311503aeeb3e](https://forums.unrealengine.com/u/Anonymous_dd56a58405288d59cf93311503aeeb3e)\
**Post date:** [June 8, 2017, 2:21am UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/8 "2017-06-08T02:21:47Z")

</div>

I look the bug marked as by design, so how to I design it can let the actor destroy when level stream unload. the actor spawn in child level bp, so i want when the child level unload , the actor instance also can destroy. how to deign ?

---

<div class="post-metadata">

**Author:** ![randallelliott](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@randallelliott](https://forums.unrealengine.com/u/randallelliott)\
**Post date:** [June 19, 2017, 1:16pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/9 "2017-06-19T13:16:15Z")

</div>

for me this is a problem…i have been using get all actors of class and then destroy actor…for each actor class that is in the scene…i have been getting other problems also when trying to unload streaming levels while using ai behaviour kit…even though i get all actors of class and delete them…over time performance drops because when deleting ai with collision spheres for mele…the actors are deleted but not the collision spheres…and even though i get all actors of class and delete the collision spheres…the peerfomrance still drops over time after streaming levels back and forth…maybe the actor is still referenced…but ■■■■…if it would just delete actors that exist on the level that would be nice

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6ce9d5dc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6ce9d5dc](https://forums.unrealengine.com/u/anonymous_user_6ce9d5dc)\
**Post date:** [November 6, 2017, 10:18am UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/10 "2017-11-06T10:18:31Z")

</div>

Spawning an actor from within the sublevel blueprint is not sufficient to bind the actor lifetime to that of the level, what you have to do is assign an owner to the new actor (in blueprint editor expand the spawn node to reveal the Owner pin). When you don’t specify an owner explicitly, the persistent level is used by default. On the other hand, if you plug any actor owned by that sublevel (or the sublevel itself) into the owner pin, the spawned actor should be destroyed correctly when the level is unloaded. You can for instance place an empty actor in the sublevel and pass it as owner to the spawn node (this can be easily wrapped inside a dedicated blueprint).

Hope it helps

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1a1a0e3a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1a1a0e3a](https://forums.unrealengine.com/u/anonymous_user_1a1a0e3a)\
**Post date:** [August 2, 2018, 5:21pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/11 "2018-08-02T17:21:33Z")

</div>

It would be great if someone could expand on how to “pass it as the owner to the spawn node” – I can seen the owner node in the _SpawnActor_ but how to get a reference to an actor that is in the level? in the level blueprint?

---

<div class="post-metadata">

**Author:** ![Kortizhian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kortizhian](https://forums.unrealengine.com/u/Kortizhian)\
**Post date:** [March 10, 2019, 10:46pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/12 "2019-03-10T22:46:27Z")

</div>

I realize it’s been a while since this question has been asked, but I’ll show you my findings regardless.  
I’ve been working on a game that uses smaller levels which are streamed in as the player gets close. In these test levels, I wanted to be able to spawn actors in dynamically, and have them despawn when the player gets too far. I made a blueprint which line traces directly downward, seeking a solid object. When this object (the landscape) was hit, the game would spawn in the barrels I made, but upon unloading the level, the barrels would persist—suspended in the void which the absent level created.

Using the hit result from the line trace, you can take the actor which was hit and set it as the barrel’s “owner”. Exactly like Mercanti said, it seems to have sent the barrels to the proper level, and they now despawn properly along with the level.

 ![270943-barrelcode.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/8/7181b874a63489e81297a56e3b522878853af73d.jpeg)

---

<div class="post-metadata">

**Author:** ![rent\_treznor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rent\_treznor](https://forums.unrealengine.com/u/rent_treznor)\
**Post date:** [February 25, 2022, 11:51pm UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/13 "2022-02-25T23:51:32Z")

</div>

Still broken in 4.27.

Actors are 100% children of a streaming level.

Some emitters persist after unload.

Any actor modified (movement/resize/etc) persists after unload.

---

<div class="post-metadata">

**Author:** ![Lupoluke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lupoluke](https://forums.unrealengine.com/u/Lupoluke)\
**Post date:** [August 14, 2024, 8:24am UTC](https://forums.unrealengine.com/t/unload-level-does-not-destroy-actors/381234/14 "2024-08-14T08:24:36Z")

</div>

Nope.  
You haven’t assigned the owner to them: if you don’t do this, Ue4 will spawn in the persistent…
