Announcement

Collapse
No announcement yet.

Not being able to server function even after setting owner

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Code:
    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.
    Last edited by envenger; 08-18-2015, 01:56 AM.

    #2
    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..
    Last edited by envenger; 08-18-2015, 02:13 AM.

    Comment

    Working...
    X