How to completely prevent mouse input from being transmitted to game logic without affecting UI logic

I want to make a inventory system and my logic is press “B” to open bag or close it. Now I face a problem. When I create bag UI 、 long press mouse button and drag, charactor view rotates. I have tried to set “Input Mode UI only” but there is an new problem that is my EnhancedInputAction IA_bag is set in BP_Charactor. Thus, my bag ui can not be closed normally. How should I do? This problem had take much time.


You just have a bool in the player ‘bag open’. When its true, just ignore the player controls :slight_smile:

I see others mention “handled” in Mouse button down Event but I do not find it actually. Can you explain it? Thank you again!

1 Like

I think that’s an override from the old input system ( UE4 ).

Another option, is ‘pause game’, it won’t affect the UI.

1 Like

Implement closing inside the inventory:

  • onKeyDown (or EI) → close inv → Input Mode Game & UI

Also, EI supports context mapping with priority. Nothing stops you from adding an entire new input scheme that works only inside the UI and consumes all else. As in:

2 Likes

Yeah, this is a good choice.

1 Like

Thank you. At first, I wanted to write function “open bag” in BP_Charactor only so that my code structure will not be chaotic. Coincidentally, I am thinking about the priority of input and you quote this post. I will try it soon. By the way, my English is not well so there may be a little misunderstandings in your past reply. I will try my best to understand it. :smiley: