Removing Fog of war from Actor

Removing fog of war when actor is destroyed

To remove fog of war component when the actor is destroyed, first override End Play function.

In MySampleActor.h add the below line:

virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;

In MySampleActor.cpp define the function:

void AMySampleActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
    UAgoraFogOfWarStatics::RemoveFogOfWarComponentFromActor(this);
    FogOfWarComponent = nullptr;
    Super::EndPlay(EndPlayReason);
}

When you play the game and destroy MySampleActor, the fog of war will be removed. 🙂

Last updated