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"

AGameMode::InitNewPlayer no longer called?

It seems as though AGameMode::InitNewPlayer is now never called when a player joins a game. There are no deprecation warnings or anything, and I can't find anything relating to this in release notes.

Where is this supposed to be called from? If it's no longer in use, can someone please add a deprecation warning? It's a bit frustrating since I now have to revert to 4.12 and use the Call Stack to find where this was previously called from.

Product Version: UE 4.13
more ▼

asked Sep 27 '16 at 09:34 AM in C++ Programming

avatar image

820 61 99 141

avatar image TheJamsh Sep 27 '16 at 09:38 AM

Tracking this down further, it seems that an override has been added, but all it actually does is call the other version?

 FString AGameMode::InitNewPlayer(APlayerController* NewPlayerController, const TSharedPtr<const FUniqueNetId>& UniqueId, const FString& Options, const FString& Portal)
     FUniqueNetIdRepl UniqueIdRepl(UniqueId);
     return InitNewPlayer(NewPlayerController, UniqueIdRepl, Options, Portal);

Surely a better approach here would be to change that functions signature and update all calls to it from elsewhere?

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

1 answer: sort voted first

Hey TheJamsh,

I don't know the exact reason why one of these isn't called but my guess is some sort of backwards compatibility where the second argument is of type:

 TSharedPtr<const FUnqiueNetID>

Instead of the new version


I can tell you that this is the InitPlayer that does get called by default:

 FString AGameMode::InitNewPlayer(APlayerController* NewPlayerController, const FUniqueNetIdRepl& UniqueId, const FString& Options, const FString& Portal)

So if you override this function (with these argument types) in your game mode, you can get the event of InitNewPlayer( ).

more ▼

answered Sep 27 '16 at 05:30 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 18 128

avatar image TheJamsh Sep 29 '16 at 11:01 AM

That seems to be the case Kyle, cheers.

I do wonder though, surely it would be better to update the signature of the original function and all calls to it elsewhere in code, rather than just have two functions in AGameMode that are basically duplicates of each other?

(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