# \[BUG\]Cant destroy Actor

**URL:** <https://forums.unrealengine.com/t/bug-cant-destroy-actor/824278>\
**Category:** C++\
**Tags:** unreal-engine, crash, question, CPP, Blueprint\
**Created:** [March 26, 2023, 10:20am UTC](https://forums.unrealengine.com/t/bug-cant-destroy-actor/824278 "2023-03-26T10:20:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thecowfork](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thecowfork](https://forums.unrealengine.com/u/Thecowfork)\
**Post date:** [March 26, 2023, 10:20am UTC](https://forums.unrealengine.com/t/bug-cant-destroy-actor/824278/1 "2023-03-26T10:20:18Z")

</div>

I created a class ACTOR from C++, which contains a static mesh component. Then I couldn’t destroy it. So I made a test with a blueprint. spawn this ACTOR, and then it couldn’t be destroyed as well.As you see:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/6/4/3649733f7de5586d1d46f791ac04b0b9076b9e97.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/0/1d05d49fcb5c07ecf821cf9cca41c753c92d04a3.jpeg)

Then I did another test. I didn’t use C++ to create a blueprint of ACTOR, and added the same static Mesh to it, then spawn it and then destroyed it. This time it was successfully destroyed.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/f/f9f1eadef6f2bb158192bf52cc78f05ade3e610d.jpeg)

Attachment:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/6/7/467d6f27ca789c989db3585177a8952401b2831c.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/6/b36e1766966dc94b6686c04d2571d502038c81ee.png)

And after waiting for a long time, the engine crashed (maybe an hour or two). If this ACTOR had not been destroyed, this situation would not have happened (it has not crashed after waiting for 4 hours). This crash has happened many times.

Thank you for watching and discussing!

---

<div class="post-metadata">

**Author:** ![High500](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/high500/32/906557_2.png) [@High500](https://forums.unrealengine.com/u/High500)\
**Post date:** [March 27, 2023, 4:53pm UTC](https://forums.unrealengine.com/t/bug-cant-destroy-actor/824278/2 "2023-03-27T16:53:06Z")

</div>

Hi @Thecowfork

Ok not sure whats going on, but, you are creating an actor and in the same breath destroying it. Is it possible that the actor does not get fully instantiated and cannot be destroyed correctly. Maybe add a delay of a second or 2 before you destroy it and see if that is the issue. If not then report back

---

<div class="post-metadata">

**Author:** ![SolidSk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/solidsk/32/1194513_2.png) [@SolidSk](https://forums.unrealengine.com/u/SolidSk)\
**Post date:** [March 27, 2023, 5:27pm UTC](https://forums.unrealengine.com/t/bug-cant-destroy-actor/824278/3 "2023-03-27T17:27:33Z")

</div>

Instead of using **Delay** use **SetLifeSpan** :

[https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/AActor/SetLifeSpan/](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/AActor/SetLifeSpan/)

 ![SetLifeSpan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/1/4/814747524fd73ce43fcb26f9e26210ca644d982b.png)

---

<div class="post-metadata">

**Author:** ![Thecowfork](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thecowfork](https://forums.unrealengine.com/u/Thecowfork)\
**Post date:** [April 13, 2023, 10:03am UTC](https://forums.unrealengine.com/t/bug-cant-destroy-actor/824278/4 "2023-04-13T10:03:49Z")

</div>

Sorry,I spent a week reading this post before, But I don’t’ t know why I didn’t’ t receive your message. I didn’t’ t see your reply the next day until I logged in today.  
But the good news is that I have solved this problem. For some reason, there is something wrong with this C++ class, and I can work normally after deleting and rebuilding it.  
Thank you for your help.
