In first person template why do I Have to click the mouse before I can move my character?
So two things and they are probably both relatively simple but I forgot how to do a couple things. One. When starting my game similar with the first person template I press alt p or play and go at it. But you HAVE to click the mouse first before you can do anything. How can I get rid of that??? It's odd that you even have to do that.
And two. When I open a menu in game up I would like all of the input commands to change. Kinda like instead of moving the character it moves a curser to differenr sections of the menu. I'm guessing I need another player controller right???? Can someone tell me how to switch that in and out for my pause menu?
To answer your first question, the problem is the game's window isn't focused. So you have to click to focus the game window. To fix this, just use the Set Focus to Game Viewport BP node on begin play. You may also need to use the Set Input Mode Game Only node.
As for your 2nd question, there are many ways you could go about doing what you want. One easy method is just with a simple boolean on your character. For example on your move forward event, have your bool hooked up to a branch node. If the bool is true, your character moves forward. If the bool is false, an event/function is called on your widget that moves the cursor up.
answered Jun 15 '17 at 08:23 PM
When I run my games and click "Play in viewport" I don't need to click into them before the mouse capture takes over. I'm not even really aware of a setting that changes that, so that sounds kinda weird to me.
As for your menu logic, there's a bunch of different ways you can go about this. I wouldn't really recommend swapping player controllers, because your player controller is still filling the role of the layer between input and your game.
You could have your player controller dispatch events out to your widget, and disable events being sent to your pawn. Or you could have all of your input events be directly on the widget (I think you can do this. You'd have to explicitly enable inputs on the widget)
answered Jun 15 '17 at 06:03 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here