Download

Be aware of GameMode::Login signature change, old one compiles but isn't called

We processed player’s join URL parameters in AGameMode::Login on first connect and AGameMode::OverridePlayerState on subsequent connects. As of 4.13 we had several bugs which were deduced to players not initializing correctly and I tracked it down to AGameMode::Login not being called. Apparently the signature of the Login and PreLogin has changed. It has been mentioned in 4.13s release notes as this:

Something to be aware of is that the old version of these functions still compile without warnings. In fact the functions still exist in GameMode.h and when called they will simply call the new function. However, the old functions are never called by the engine and thus if you rely on your PreLogin/Login functions and your overrides still use the old function signature. You should update them!

Use the second of each of these:



	// Not called
	virtual void PreLogin(const FString& Options, const FString& Address, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage);
	// Called
	virtual void PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage);
	
	// Not called
	virtual APlayerController* Login(class UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage);
	// Called
	virtual APlayerController* Login(class UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage);


Just wanted to share this since I suspect many to use these functions.