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

**URL:** <https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [May 14, 2024, 2:51pm UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764 "2024-05-14T14:51:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElectricRhino597](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ElectricRhino597](https://forums.unrealengine.com/u/ElectricRhino597)\
**Post date:** [May 14, 2024, 2:51pm UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/1 "2024-05-14T14:51:17Z")

</div>

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/9/d196539091a9ede4564b9c59c8aed7cd8b6930b5.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/1/0c1f8d2a7584c405b4ab16153756b52046d67978.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 14, 2024, 5:17pm UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/2 "2024-05-14T17:17:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ElectricRhino597](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ElectricRhino597](https://forums.unrealengine.com/u/ElectricRhino597)\
**Post date:** [May 15, 2024, 12:23am UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/4 "2024-05-15T00:23:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 15, 2024, 9:05am UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/5 "2024-05-15T09:05:14Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 15, 2024, 9:47am UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/6 "2024-05-15T09:47:09Z")

</div>

> [@ElectricRhino597](#):
>
> 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?

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:

> [@"Consume input" doesn't work (the input still propagates everywhere)](https://forums.unrealengine.com/t/consume-input-doesnt-work-the-input-still-propagates-everywhere/1213316/4):
>
> Imagine I have 2 sets of controls: IMC\_Default (Priority 0) to move around with WASD IMC\_Backpack (Priority 1) to move between backpack slots, also with WASD if priorities are equal, the one added last gets to the hardware input first When I open my backpack and WASD inside it, I’d rather not walk off the cliff, so I add a new Mapping Context with higher priority, so it can intercept Actions associated with keys: Think with mapping contexts - abstracted layers of input. I…

---

<div class="post-metadata">

**Author:** ![ElectricRhino597](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ElectricRhino597](https://forums.unrealengine.com/u/ElectricRhino597)\
**Post date:** [May 15, 2024, 12:01pm UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/7 "2024-05-15T12:01:59Z")

</div>

Yeah, this is a good choice.

---

<div class="post-metadata">

**Author:** ![ElectricRhino597](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ElectricRhino597](https://forums.unrealengine.com/u/ElectricRhino597)\
**Post date:** [May 15, 2024, 12:17pm UTC](https://forums.unrealengine.com/t/how-to-completely-prevent-mouse-input-from-being-transmitted-to-game-logic-without-affecting-ui-logic/1855764/8 "2024-05-15T12:17:08Z")

</div>

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. 😃
