I made a new c++ project and started the c++ programming tutorial. Now I want to increment an integer variable whenever I click on my actor.
I googled a bit and apparently I have to enable mouse input in the player controller. I made a new one since I didn’t have it already. Now I need to set the player controller in the game mode. I can’t edit the player controller with project settings - maps & modes (everything is greyed out). I’m guessing that is because it is a c++ project. So I have to change the playercontroller in my gamemode.cpp file? There’s no playercontroller variable or a setplayercontroller function as far as i know, so how do I do this?
Or would it be better to make a new blueprint gamemode and set a blueprint playercontroller in the project settings?
Thanks for the article! I have a few questions though.
My player controller blueprint is called MyPlayerController so I changed the type from AYourPlayerController to AMyPlayerController, but it says it’s undefined?
Where do I put the code? My cpp is just an empty file apart from a few includes, do I need to override a function?
It sounds like you need to include your MyPlayerController class’ header file. Search for “class AMyPlayerController” and include the file that this class is declared in. If you search for “class AMyPlayerController” and it isn’t found, then you haven’t created that class anywhere.