Is there a way to possess a pawn like this
but in c++ code, because so far when i type “unreal engine 4 c++ possession” all that comes up is blueprints
Is there a way to possess a pawn like this
but in c++ code, because so far when i type “unreal engine 4 c++ possession” all that comes up is blueprints
Here is the particular function in the docs: AController::Possess | Unreal Engine Documentation
This function occurs on the controller, so first you’ll want to get the particular character controller then call this function on it with whatever pawn you are switching to (it will unpossess automatically).
Possesing a new pawn would require the following steps:
Cheers,
Moss
You should not forget to cache your player controller too
APlayerController* controller = GetController();
controller->UnPossess();
ACharacter* character = GetWorld()->SpawnActor...
controller->Possess(character);
otherwise GetController() from unpossessed pawn will return null
what includes please ?