x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Client Possession Out of Sync

I'm working on simply setting up some basic variables inside the controller during possession that are only needed to be known by the owning client of a custom controller. In my attempt to do this, the functions Possess() on a Controller and PossessedBy() on a Pawn are the perfect place to initialize these settings.

However! Not all is well during the possession, it seems that when a client starts up at the beginning of the game, they receive their controller as PlayerController_0, which is what's passed through during all the possession functions for both Pawn and Controller. Afterwards, PlayerController_0 disappears from all knowledge and is replaced by PlayerController_1 which doesn't seem to transfer over settings from PlayerController_0 for the client, and no new Possession chain is called.

This is painful, as I can't exactly set my variables now without a workaround due to the out of sync possession, is there anyone who can explain to me what I'm missing?

BLTPlayerController.cpp

 void ABLTPlayerController::Possess(class APawn* inPawn)
 {
     Super::Possess(inPawn);
 
     UE_LOG(LogPC, All, TEXT("=== ABLTPlayerController ==="));
     UE_LOG(LogPC, All, TEXT("%s"), *GetName());
     UE_LOG(LogPC, All, TEXT("inPawn = %s"), *inPawn->GetName());
     //Just gives us a reference to our own specific custom pawn so we don't have to constantly cast
     ADebugFunctions::LogNetworkRoles(inPawn);
     
     Test(inPawn);
 
 }
 
 void ABLTPlayerController::Test(APawn* inPawn)
 {
     UE_LOG(LogPC, All, TEXT("Currently: %s"), *GetName());
     CharacterPawn = Cast<ABLTPlayerPawn>(inPawn);
     TestPawn = inPawn;
 }

Here is a photo of the log that shows it starting off as PlayerController_0 and setting variables, then becoming PlayerController_1 afterwards with no sign of the original PlayerController_0

Product Version: Not Selected
Tags:
debugtest.jpg (433.1 kB)
more ▼

asked Aug 16 '14 at 01:40 AM in C++ Programming

avatar image

IrishKilter
89 13 16 27

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question