Set Show Mouse Cursor and Set Cursor not properly hiding cursor

I’m trying to set up a system for the player to be able to switch input methods between Mouse/Keyboard and Controller. Most of it is working except that in most of the instances where I switch to Controller, the Cursor doesn’t seem to disappear. I’ve been using the Set Show Mouse Cursor node as well as the Set Cursor node, as recommended in this thread, but without much luck. I’ve even tried two versions of the “set Cursor” node for good measure (by good measure I mean I’ve been getting desperate and trying everything). the following image is from a function UpdateFocus that gets called each time CommonInput detects that the input method has changed, as well as when a menu is opened. The print statement at the end confirms the code is getting called, but the cursor still sticks around.


Ideally, I’d like to get the cursor to disappear in my UpdateFocus function. I also have a point where I (try to) hide it upon exiting the menu. This works, but only when exiting the menu with mouse/keyboard. If the player switches to Controller while in the menu, then exits out, the cursor continues hovering over the gameplay. The Player can still move the mouse, which then moves the camera below it. Functionality gets even further broken when the player tries to click, the camera no longer follows the mouse unless the player holds down the click button. The Cursor does disappear while the player is holding the mouse, leading me to believe it’s related to my usage of the “set input mode game and UI” node, wherein I have “hide cursor during capture” set to true. However I should be setting back to input mode game only when I hide menu. This is another place where I’m trying to dismiss the mouse cursor through Set Cursor and Set Show Mouse Cursor, but to no avail. Once again, the print statement is being called, so I know it’s not just an issue with the code being called. For whatever reason it’s just not properly dismissing the cursor when it does so.

I was using the Set Input Mode… nodes prior to encountering this issue, but I have double checked This behavior after seeing a few other forum posts recommend Using Set Input Mode Game Only. As far as I can tell I’m doing the correct swaps everywhere I should be doing so.

The only other possible cause for this issue I can conceive of would be that I’m accidentally re-setting something about the cursor? Such as setting “show Cursor” to true in a completely different class at the same time that I’m trying to hide it. However I’ve pored through my code pretty extensively to check this isn’t the case. I mentioned double checking the Set Input Modes, I’ve also checked for all references to “Set Show Mouse Cursor” and “Set Cursor”. Using the Find in blueprints feature to identify each point the nodes are used, and using breakpoints and print statements to verify they’re not accidentally getting called when I’m trying to hide the mouse. If there are other nodes I should try looking for I’m open to suggestions. But overall I suspect this is a deeper issue with something I’m not understanding about the functionality, or even a continuation of this forum, suspecting it to be a bug with unreal, rather than just spaghettified UI code.

It sounds like you’re encountering a issue with cursor visibility when switching between Mouse/Keyboard and Controller input methods. Based on your description and the troubleshooting steps you’ve already undertaken, here are a few additional suggestions to help resolve the problem:

  1. Ensure Consistent Input Mode Switching: Double-check that the input modes are being switched correctly across all relevant areas of your code. When switching to Controller input, make sure you are consistently setting the input mode to “Game Only” or “Game and UI” as appropriate. For example:
  • Switching to Controller: Use “Set Input Mode Game Only” and ensure “Show Mouse Cursor” is set to false.
  • Switching to Mouse/Keyboard: Use “Set Input Mode Game and UI” and ensure “Show Mouse Cursor” is set to true.
  1. Verify Set Show Mouse Cursor Usage: Confirm that the Set Show Mouse Cursor node is only called in the contexts where it is supposed to be active. Ensure there are no conflicting calls in other parts of your code that might inadvertently reset the cursor visibility.
  2. Check for Cursor Visibility in Other Classes: It is possible that cursor visibility is being altered by another class or blueprint. Utilize the “Find in Blueprints” feature to search for all instances of the Set Show Mouse Cursor node across your entire project to ensure that no unintended changes are being made.
  3. Review Menu Transition Logic: When exiting the menu, ensure that you are correctly setting the input mode back to “Game Only” and that the cursor visibility is being set as intended. You might want to explicitly set the cursor visibility to false in your menu exit logic to handle any potential inconsistencies.