Skip to content

Instantly share code, notes, and snippets.

@AchimTuran
Created January 14, 2022 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AchimTuran/0eed453e6c3c73fb84e80c7b3f00c6ee to your computer and use it in GitHub Desktop.
Save AchimTuran/0eed453e6c3c73fb84e80c7b3f00c6ee to your computer and use it in GitHub Desktop.
Force Unreal Engine Actor Component Destruction from Blueprints
#include "TUtils.h"
// Unreal Engine includes
#include "Components/ActorComponent.h"
void UUtils::ForceDestroyComponent(UActorComponent* ActorComponent)
{
if (ActorComponent && ActorComponent->IsValidLowLevel())
{
ActorComponent->DestroyComponent();
}
}
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Utils.generated.h"
// forward declarations
class UActorComponent;
UCLASS() class TUTILS_API UUtils : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
static void ForceDestroyComponent(UActorComponent* ActorComponent);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment