Not being able to server function even after setting owner

I have a character that gets spawned on the server.

Calling any server function on that character doesn’t work even though I have set its owner.


void ACharacterPlayerController::Possess(APawn* aPawn)
{
	Super::Possess(aPawn);// Only gets called on the server

	OwnedCharacter = GetWorld()->SpawnActor<APlayerCharacter_1Movement>(OwnedCharacterClass, aPawn->GetActorLocation(), aPawn->GetActorRotation());
	OwnedCharacter->SetOwner(this);
	OwnedCharacter->Instigator = aPawn;
}

As the function is called in the Posses of the PlayerController, its just called on the server.

But no sever function gets called in the character.

The same exact thing works with an Actor class but not the character class…
It seems to me that there is an error or something… I have been working on networking for the past 1 year at least but I never had to create a character class then set its owner.

Found the error…

If a character is possessed by an AI controller, either server functions can’t get called on it or some issue with ownership.
Taking the AI controllers ownership lets see if that helps.

—Edit—

Taking ownership over the AI controller is making it work…

1 Like

Dude! I know this is really old but it fixed my problem. You have to set the ownership to the IA controller, not the actor. Thanks!