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.

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?

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( ).

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?