Created
January 14, 2022 01:17
-
-
Save AchimTuran/0eed453e6c3c73fb84e80c7b3f00c6ee to your computer and use it in GitHub Desktop.
Force Unreal Engine Actor Component Destruction from Blueprints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TUtils.h" | |
// Unreal Engine includes | |
#include "Components/ActorComponent.h" | |
void UUtils::ForceDestroyComponent(UActorComponent* ActorComponent) | |
{ | |
if (ActorComponent && ActorComponent->IsValidLowLevel()) | |
{ | |
ActorComponent->DestroyComponent(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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