So upon updating to UE 4.1.0, My compiler started throwing a warning C4264 and C4263 saying that my InitNewPlayer function in my GameMode class does not override any function from the base class, and that the function i’m trying to override is hidden. However, upon inspecting the GameMode.h, i’ve found that the virtual InitNewPlayer function is “Protected”, so my GameMode, deriving directly from AGameMode, should be able to see it and override it. Even if i remove the “virtual” and “OVERRIDE” from the line, and rebuild all PCH’s it throws the same error. I have even gone so far as to comment out the “protected:” visibility modifier in the GameMode.h file, and it does not affect the outcome. It worked before the update, is there anything that changed in the API from 4.0 to 4.1 that could cause this? is there some common mistake i could have made when updating that could have caused this? i right clicked on the .uproject and switched the engine to 4.1, then right clicked and had it generate .cpp files for the new engine as the instructions specified.
I am using:
Windows 7 64-bit
Microsoft Visual Studio 2013 express - Development Editor
* Customize incoming player based on URL options
* @param NewPlayer player logging in
* @param UniqueId unique id for this player
* @param Options URL options that came at login
virtual void InitNewPlayer(AController* NewPlayer, const TSharedPtr<FUniqueNetId>& UniqueId, const FString& Options);
Can you post your OVERRIDE version?
in the header:
public: virtual void InitNewPlayer(AController* NewPlayer, const FString& Options) OVERRIDE;
in the cpp:
void AMyGameMode::InitNewPlayer(AController* NewPlayer, const FString& Options)
// assign to team
AMyPlayerState* NewPlayerState = CastChecked<AMyPlayerState>(NewPlayer->PlayerState);
const int32 TeamNum = ChooseTeam(NewPlayerState); //assign team based on random alg
Based on your comment, this is the result of an API change in 4.1.
AGameMode::InitNewPlayer gained a new parameter in 4.1, the
const TSharedPtr& UniqueId. Even if you don’t use this parameter inside your override, the declaration in your derived GameMode class must match the declaration in the superclass.
Try adding the new parameter to your own InitNewPlayer function (both the header and the .cpp file), that should fix the warnings.
ugh, don’t know why i didn’t notice that. thank you, sir.