UWorld::DestroyActor

Removes the actor from its level's actor list and generally cleans up the engine's internal state.

Choose your operating system:

Windows

macOS

Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/World.h

Include

#include "Engine/World.h"

Source

/Engine/Source/Runtime/Engine/Private/LevelActor.cpp

Syntax

bool DestroyActor
(
    AActor * Actor,
    bool bNetForce,
    bool bShouldModifyLevel
)

Remarks

Removes the actor from its level's actor list and generally cleans up the engine's internal state. What this function does not do, but is handled via garbage collection instead, is remove references to this actor from all other actors, and kill the actor's resources. This function is set up so that no problems occur even if the actor is being destroyed inside its recursion stack.

Removes the actor from its level's actor list and generally cleans up the engine's internal state. What this function does not do, but is handled via garbage collection instead, is remove references to this actor from all other actors, and kill the actor's resources. This function is set up so that no problems occur even if the actor is being destroyed inside its recursion stack.

Returns

true if destroy, false if actor couldn't be destroyed.

Parameters

Parameter

Description

ThisActor

Actor to remove.

bNetForce

[opt] Ignored unless called during play. Default is false.

bShouldModifyLevel

[opt] If true, Modify() the level before removing the actor. Default is true.

ThisActor

Actor to remove.

bNetForce

[opt] Ignored unless called during play. Default is false.

bShouldModifyLevel

[opt] If true, Modify() the level before removing the actor. Default is true.