# Destroy actor vs hide actor

**URL:** <https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611>\
**Category:** World Creation\
**Tags:** hide, Destroy-Actor, unreal-engine, Physics, Collision, question\
**Created:** [October 8, 2020, 6:09pm UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611 "2020-10-08T18:09:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soleniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soleniah](https://forums.unrealengine.com/u/Soleniah)\
**Post date:** [October 8, 2020, 6:09pm UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/1 "2020-10-08T18:09:02Z")

</div>

Hi. I 'm making some blueprints where I spawn AI 's. After I kill them, I hide them and disable their collision, so I can count them and move on the next part of the game.

1)is that method ok?  
2)should I destroy the AI 's after I accomplish my goals? Do they affect the game if they stay hidden?

---

<div class="post-metadata">

**Author:** ![chrudimer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chrudimer/32/918651_2.png) [@chrudimer](https://forums.unrealengine.com/u/chrudimer)\
**Post date:** [October 8, 2020, 6:33pm UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/2 "2020-10-08T18:33:39Z")

</div>

Hi,

> 1)is that method ok?

Destroying many actors at once may cause spkes, so you can disable them instead if you want to. Especially if you want to reuse them, instead of spawning new ones.

> I hide them and disable their  
> collision

That is not enough. You need to disable tick and all timers on both the pawn and the AI controller and also disable tick and deactivate each and every component. Otherwise CPU performance cost will still be there.

> Do they affect the game if they stay  
> hidden?

That mainly depends on the logic you have build. If you use something like “GetAllActorsOfClass” then those disabled actors will of course show up there as well. Also object references to them won’t get invalid. Further every time you use “GetAllActorsOfClass” it will loop through each and every actor you have in your world. Therefore if you have a couple of thousand disabled actors in your world that will of course increase the performance impact of “GetAllActorsOfClass” (but then you should generally be careful using this node during gameplay).

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [October 8, 2020, 11:13pm UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/3 "2020-10-08T23:13:53Z")

</div>

Depends on the complexity of the actor … as Chrudimer noted. Personally I destroy actors.

---

<div class="post-metadata">

**Author:** ![Soleniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soleniah](https://forums.unrealengine.com/u/Soleniah)\
**Post date:** [October 9, 2020, 7:39am UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/4 "2020-10-09T07:39:52Z")

</div>

Thanks for your helpful answer!

---

<div class="post-metadata">

**Author:** ![Soleniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soleniah](https://forums.unrealengine.com/u/Soleniah)\
**Post date:** [October 9, 2020, 7:40am UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/5 "2020-10-09T07:40:47Z")

</div>

They are pretty simple. Basically these AI’s are just for the tutorial of the game. Probably I 'll destroy them anyway. Thanks for your answer!!

---

<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:** [October 9, 2020, 9:14am UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/6 "2020-10-09T09:14:25Z")

</div>

> After I kill them, I hide them and  
> disable their collision, so I can  
> count them and move on the next part  
> of the game.

- if you do it one by one, you should consider destroying them if you have no plan of recycling them back into the game. It’s a memory footprint friendly approach.

- if you must destroy a huge amount in one go, doing it in one frame can make the Garbage Collection go into a _hiccup_ mode and it might be noticeable during gameplay. An easy solution is to disable them fully as @chrudimer pointed out and then destroying some of them each second / a couple each tick. Essentially, spread the workload over some time.

- if your game is small, it probably does not matter much

- if you load another level, it probably does not matter much, they’ll be wiped anyway

* * *

If you’re not destroying them because you need to count them, consider the following:

> **[Game Over on destroy all actors](https://forums.unrealengine.com/questions/980394/game-over-on-destroy-all-actors.html)**
>
> 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...

You can use the _Destroyed_ event to count things. Best of both worlds.

---

<div class="post-metadata">

**Author:** ![Soleniah](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soleniah](https://forums.unrealengine.com/u/Soleniah)\
**Post date:** [October 10, 2020, 8:08am UTC](https://forums.unrealengine.com/t/destroy-actor-vs-hide-actor/472611/7 "2020-10-10T08:08:53Z")

</div>

Thanks for your answer!!
