I’m trying to set up an inventory menu. I’m setting the input mode to “game and UI” when the menu is opened because I need access to keyboard inputs which are disabled in “UI only” input mode. The problem is that in “game and UI” input mode, the mouse cursor disappears when the right mouse button is pressed, which is preventing some of my button logic from working because OnUnhovered immediately gets called. Is there a way to override this behavior so that RMB can actually be used properly for the UI?
“game and UI” does not make the right mouse button disappear, you must have the problem somewhere else
I have already set bShowMouseCursor to true and it is shown when the menu opens. It just disappears while the right mouse button is down.
When game and UI input mode is active, the right mouse button is used to switch between game input and UI input. When it is held, the cursor is hidden and the player is able to move the character and turn the camera. I need a way to disable that.
The right click is probably tied to camera logic. Either in the player controller or character.
Have a bool that toggles if you are in the inventory and override that camera logic (through a branch)
either
- enforce the cursor visibility there
- make the engine ignore the camera input.
You can also have a full screen canvas in inentory that triggers iu only (its a 100% transparent)
I just had to add a line when setting up the input mode:
FInputModeGameAndUI InputModeData;
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::LockInFullscreen);
InputModeData.SetHideCursorDuringCapture(false); // Added this line
InputModeData.SetWidgetToFocus(TakeWidget());
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.