How to make the cursor appear and hide

I want to make sure that when you click on TAB the cursor appears on the screen and the player can interact only with the UI and when you click again the cursor disappears and interact only with Game mode

Hello, hope I can help.

You should be able to do this by getting the player controller in the BP you are reading the input logic. The player controller will have Set Input Mode UI Only and Set Input Mode Game Only functions. You will also want to change the ShowMouseCursor bool in the player controller depending on when you want it to show or not.

Below is a screenshot of a way you can implement this idea.

Let me know if this works out for you and gives you the desired effect :slightly_smiling_face:

1 Like

Hello @BRGCooper!

How to create an InputAction TABinput if this is a stupid question then I apologize

Not stupid at all! We all gotta learn.

You can make a new input action mapping by going to your input section in the project settings.

Press the plus icon and make a new input you name, then add any bindings you want to work with it by pressing the plus button next to the new input’s name

1 Like

I managed to create an input but for some reason when you click again the cursor does not disappear

Do I need any other information?

Ah, I made a mistake and forgot that when you do UI only mode, your previous input from that pawn will not be registered. I would suggest changing to Set Input Mode Game and UI unless you want to only be able to get out of your UI menu with clicking a button on the UI menu. This mode allows you to still access UI elements while keeping your game inputs.

If you need to restrict any other inputs set up with the player, you may want to add bool checks to see the controller’s current input mode.

1 Like

Okay I’ll try it now

Thank you, you were right thanks to this I solved the question

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.