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?

Simple if w,a,s,d move the character but once I pause the game I wasn’t w,a,s,d to move a cursuer to different objects, an I switching player characters or controlllers?.
And yes when I press Alt P. Before anything works I have to click the mouse button. It’s like I have to click the screen before I do anything.

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)

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.

2 Likes

Ok the first part worked perfectly thank you!!!

The second part is working I have it marking the cursor go up and down as you said but the only problem is that I only want the cursor to go down 1 interval every time the button is pressed. I have it going up or down based on weather it’s greater than or less than 0 but it just flies either direction off screen. How can I make it take the input only once untill I do it again? Instead of constant like movement would be???

Use a Do Once node and On Release of the button, reset the Do Once node. Alternatively you could just move the cursor On Released instead of On Pressed.

This is a axis node so there is no pressed or released. It’s set to move the character foward and backward like in the FP setup.