Hello!
In my GameMode I’m trying to Spawn the character of my player and then make my controller posses that pawn, but the game crash with a window saying “Fatal Error!” with the line:
“aux->Controller->Possess(ActualP);”
What I could be doing wrong?
EDIT:
The game also Crashes when I try to get the NetOwner of the ActualP pawn I just spawned.
This is my code:
[FONT=Courier New]auto Actual = GetWorld()->SpawnActor(Skin, &Location, &Rotation);
APawn* ActualP = Cast<APawn>(Actual);
if (ActualP == nullptr)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *FString(“Error”));
}else
{
if (ActualP->Controller == nullptr)
{
aux->Controller->UnPossess();
//The Error is here
aux->Controller->Possess(ActualP);
}
}