How to NOT destroy pawn after logout/exit?

[Solution found here.][1]

Variant for changing the engine.
In your C++ class, simply redefine the method by using it.

Create your Controller Class, and make it a function in the similarity:

.h

UFUNCTION (BlueprintNativeEvent, BlueprintCallable, Category = Miheev)
void PawnLeavingGame ();

UPROPERTY(EditAnywhere, BlueprintReadWrite, config, Category = Miheev)
bool DestroyActorThenUnpossess;

.cpp

void AMController :: PawnLeavingGame_Implementation ()
{
if (GetPawn ()! = NULL && DestroyActorThenUnpossess)
  {
   GetPawn () -> Destroy ();
   SetPawn (NULL);
   }
}

The redefinition source is in the code:
UnrealEngine\Engine\Source\Runtime\Engine\Classes\GameFramework\PlayerController.h
UnrealEngine\Engine\Source\Runtime\Engine\Private\PlayerController.cpp

And now the destruction can be regulated through the Blueprints! Yess!

220225-2017-11-15-18-55-18-miheev-unreal-editor.png

I hope this will add to the standard functionality. After all, the weight of this code is only 138 bytes, and the use of space.

5 Likes