Cast PlayerController to MyPlayerController is failed

Did you set up your custom player controller on the gamemode you are currently using?