I’m pretty new to UE4, so after watching a few tutorial videos, digging through the documentation, and fiddling with the Editor, I’m currently playing around with the Blueprint Top Down Template Project.
While that project is a good base template for what I want to do, I though the camera needed tweaking. I wanted to get the user input on some axis (Mouse X), translate it to a rotation change, and apply that to the camera boom. I put together a simple Blueprint script for that. However, I noticed that the events in my script wouldn’t start the execution line once I start the game.
Now, for getting to the root of this, I set up a script containing “F” (keyboard key) as the event, and “print” with default values as the result. This script works just fine within the “MyController” Blueprint, however in the “MyCharacter” Blueprint it does not. My reason for putting it in the “MyCharacter” Blueprint in the first place was that since the camera and camera boom are components in the MyCharacter Blueprint, if I want to access them I need to do it there.
Does anyone know why, and what I can do to change it? Maybe I’m doing this entirely the wrong way, even? Any help would be greatly appreciated.
How to reproduce the problem:
You can reproduce this in a fresh Top Down Blueprint Template Project (including starter content) by adding a simple “Key input → print” script to the EventGraph first of the “MyCharacter” Blueprint, then to the “MyController” Blueprint. I have already tried various ways to enable input on the MyCharacter Blueprint, i.e. setting “Auto Receive Input” to “player 0” in the defaults, or adding another script that enables input on “Being Play”, but to no avail.
The MyController Blueprint is overriding the input on the character Blueprint. You can set the Player Controller setting to the default setting of “PlayerController” in the World Settings. That would allow you to use input inside the MyCharacter Blueprint but would mean however that the inputs from the MyController Blueprint would no longer be valid.
You’d either need to replicate the inputs from MyController inside the MyCharacter Blueprint, or in the MyController Blueprint get reference to your components from the MyCharacter Blueprint. It’s a little different than the other templates which use MyCharacter to drive input, instead of a controller.
Thanks a bunch for your reply. The bit about the MyController Blueprint overriding the character Blueprint was the crucial bit of information. Is there some article where I can learn about what overrides what else, if there are more cases like this?
Concerning my case, I’ve since solved this by adding a new MyCharacter_C type variable and this script to my MyController Blueprint:
From what you said, I could have just as well reversed this and set up everything in the MyCharacter Blueprint, setting the PlayerController default in the World Setting. Can you elaborate on what would be preferred from a best practice point of view, i.e. use a custom Character Blueprint or a custom PlayerController Blueprint?
Take a look at this post from Jeff Farris who explains the purpose of the Player Controller. It’s perfectly acceptable to do your input in the Character Blueprint, however as Jeff points out, there are advantages to doing it in the Controller Blueprint:
Hi Wes. Cheers for the link, that was very helpful. Best!