[Question] How to destroy an actor properly in C++?

#IsValidLowLevel()

When you are frequently deleting objects, to avoid crashes, you have to always use

if (!UObject::IsValidLowLevel()) return;

:slight_smile:

so the way I check validity of frequently-deleted-pointer references is like this:

:slight_smile:

if(!ActorRef) return;
if(!ActorRef->IsValidLowLevel()) return;

ActorRef->SayHi_StillAliveforReal();

At least, this is what has worked for me in my editor mode where I delete stuff all the time.

So until Epic answers you with some additional info

just add the IsValidLowLevel() checks

and you should stop the crashing

:slight_smile:

I delete sometimes 30 material instances within seconds and entire levels full of actors in a single tick, and my method has worked so far

but I agree

this is all not exactly intuitive or simple to approach :slight_smile:

Which is why I think regular delete functions dont instantly do anything drastic (like a full purge of GC), to avoid the crashing

:slight_smile:

RAma