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"

Seamless travel spawning players

I was experimenting with seamless travel for my MP game and I noticed the player actors are lost in the process I now spawn them in the gamemode like this:

 void ABbGameMode::PostSeamlessTravel()
 {
     Super::PostSeamlessTravel();
 
     for (FConstPlayerControllerIterator Iter(GetWorld()->GetPlayerControllerIterator()); Iter; ++Iter) 
     {
         SpawnPlayer(Iter->Get());
     }
 }

This works but im wondering if this is the appropriate way to do it?

Thanks.

Product Version: UE 4.19
Tags:
more ▼

asked Jun 06 '18 at 09:19 PM in C++ Programming

avatar image

92Rob
98 1 3 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You can keep your actors by overriding the AGameModeBase::GetSeamlessTravelActorList (on server side) or the APlayerController::GetSeamlessTravelActorList (per client) methods and add the actors to the list of kept actors during seamless travel.

You will lose the connection between the controllers and the pawn though, as I state here, so you'll have to re-possess the pawns after server travel, for instance by implementing AGameModeBase::HandleStartingNewPlayer_Implementation (this is called also when loading the first level)

more ▼

answered Mar 04 '19 at 03:27 PM

avatar image

developpeur2000
77 1 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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