# UI buttons become inactive after clicking world

**URL:** <https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [February 6, 2024, 3:17pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128 "2024-02-06T15:17:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 3:17pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/1 "2024-02-06T15:17:16Z")

</div>

In my game, the player cannot see the mouse cursor and input mode is game only by default. (Mouse movement input is used to look around).

 ![Default](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/a/c7aa18c63371db80bab8e44a169dbb766746693f.jpeg)

Once the player holds RMB, the cursor is shown to the player, the input mode is switched to game and UI mode and the movement of the mouse no longer makes the camera move. I’m using this mode to allow the player to click on actors placed in the world.

Once an actor is clicked, they display a unique UI element to the screen that only takes up a portion of the screen and has buttons on it allowing the player to direct the actors behaviour (Example: Activate a skill move).

 ![ClickedOnActor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/8/f18954649155b8c5f9fa7e36f4927530c8a366f0.jpeg)  
(My screen capture doesnt capture the mouse cursor for some reason but in reality, the mouse cursor is visibile in the above image)

When I click on the actor the first time, it brings up its unique abilities bar, from there I can either click on the button on the UI element or click on the world (select a different actor and so on), so far so good.

 ![ButtonPressed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/4/3446095f6a3ae844d05c2d8c90a076c56f883125.jpeg)  
(Button on UI element is pressed and registered; String is printed to screen for debugging)

The issue is though, If I click on the world, I can no longer click back on the button in the UI element (it becomes inactive for some reason). I want to be able to click on the world without the UI elements buttons becoming inactive (Cannot not click on them).

Assistance would be greatly appreciated, more than willing to provide further detail upon request… Many thanks!

---

<div class="post-metadata">

**Author:** ![sonictimm](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sonictimm/32/625173_2.png) [@sonictimm](https://forums.unrealengine.com/u/sonictimm)\
**Post date:** [February 6, 2024, 4:11pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/2 "2024-02-06T16:11:14Z")

</div>

> [@EasyAL](#):
>
> In my game, the player cannot see the mouse cursor and input mode is game only by default.

Can you show the logic where you switch the Input Mode between Game Only and Game And UI?

Whenever I change that, I usually also change a variable on the player controller.  
Get Player Controller → Set Show Mouse cursor (true / false)

I’m too lazy to screenshot, so look at this thread: [Show mouse cursor in BP?](https://forums.unrealengine.com/t/show-mouse-cursor-in-bp/379299)

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 4:16pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/3 "2024-02-06T16:16:49Z")

</div>

Hi Sonictimm, thanks for the reply… here is the requested screenshot:

 ![Screenshot (159)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/9/20936e02c8bb7beb5823c36d00bf63183b46680e.png)

Just to be clear, the mouse cursor not showing is not my issue, the hidden cursor by default is intended (i only want the cursor to show when the player holds RMB and that is implemented and works as intended too, its just that the screenshots dont show my cursor for some reason)… the cursor shows perfectly, its just that if i click on the world, the buttons on the UI element becomes inactive (still on the screen but i can no longer click on it)

---

<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:** [February 6, 2024, 4:24pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/4 "2024-02-06T16:24:34Z")

</div>

> [@EasyAL](#):
>
> its just that if i click on the world, the buttons on the UI element becomes inactive

Three things can be causing this:

- we enter Game Only input mode (I’d double-triple check that first)
- something else (another widget) consumes mouse input

> Once an actor is clicked

What happens when this terminates / is cancelled?

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 4:28pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/5 "2024-02-06T16:28:17Z")

</div>

I’m certain we do not enter game only mode when we click. I suspect it has something to do with the Game and UI input mode (Image shows the description of the node):

 ![Screenshot (161)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/1/e21eb69bd875e04701fef0a1b28ce0e397cac74e.png)

I suspect when the click is not handled by the UI, it gives “player input / player controller” a chance but it doesn’t ever switch back to allowing the UI to handle the click. Any ideas?

---

<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:** [February 6, 2024, 4:30pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/6 "2024-02-06T16:30:30Z")

</div>

> [@EasyAL](#):
>
> Any ideas?

- how do you detect clicks in the widget?
- does the widget have enough hit-testable elements to start with?
- have you tried setting widget focus with the _Game and UI input_ node

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/f/1/cf1e5ca8664237628d4fd88ae73d54da5af16f13.png)

* * *

Place a regular native button in the widget as a test (if you have none), they are infamous for stealing focus whenever hovered/clicked. Can you click a simple button? If you cannot, it’s time for the `Widget Reflector` debugging:

> **[Widget Reflector](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Slate/WidgetReflector/)**
>
> An overview of Widget Reflector, a tool that enables developers to identify and debug Slate widgets.

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 4:32pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/7 "2024-02-06T16:32:53Z")

</div>

I believe nothing, here is the logic:

Check if mouse cursor is on (dont want anything to happen if its off)

Then check if we have a ref to an actor, if we dont, we get the ref to the actor under the mouse (line trace) and get the actor to show its UI elements through a BP interface. If we already do have a ref to an actor, we tell it to move to the spot under the mouse curor.

 ![Screenshot (162)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/c/a8c76ea9b5a92191e768110aafd95a662977e85f.png)

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 4:38pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/8 "2024-02-06T16:38:27Z")

</div>

Here is a screenshot of the widget class, the mouse cursor is hovering over the button (just noticed the screenshot is still not capturing the cursor, the button is the grey box with blue outline):

 ![Screenshot (163)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/1/4a10000a96647d1a25e784b1f43ddf5680d94e7a.png)

The strange thing is, the button works perfectly fine if i click on the button before clicking on the world… but once i click on the world, the button becomes inactive (just doesnt detect clicks)

And i have already tried the focus widget thing, no change.

---

<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:** [February 6, 2024, 4:47pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/9 "2024-02-06T16:47:53Z")

</div>

> [@EasyAL](#):
>
> the button becomes inactive

If you cannot click the button:

- we’re in the Game Only input mode
- the widget (or its parent) is set to be not hit-testable
- the widget is disabled
- another widget consumes input

UI goes first in Game and UI mode; if `unhandled`, it tunnels to the PC. You cannot un-handle a button unless you actually use a precise-click. And even then, it’d be a hassle. I stopped using buttons for that reason alone - you just cannot shake them off.

* * *

Consider having a look at the widget reflector - it **is** a tool designed to handle this.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/3/d036ae049912961f2eb6b09a5f031f5c39cb5306.png)

Start picking widgets in PIE, see what you get:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/d/1dd588c038e86380de3d2aa1c2304796b2d6158c.png)

* * *

You could also `Flush` input on the nodes you have up there, in case something does get stuck, indeed.

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 4:53pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/10 "2024-02-06T16:53:12Z")

</div>

BTW thanks for your time. Heres what i got:

 ![Screenshot (164)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/c/66c317a84e7769dacafcdf4fa4585d7b8f1be6b0.png)

I have never used this so ur insight is appreciated.

---

<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:** [February 6, 2024, 4:54pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/11 "2024-02-06T16:54:20Z")

</div>

You need to use it in PIE - Play in Editor - while you play. In the actual viewport of the game, when the issues manifest. In short, run the reflector, run the game, mouse over stuff that misbehaves, observe the list. Is the cursor hitting what it should be hitting - the button?

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 4:58pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/12 "2024-02-06T16:58:34Z")

</div>

Got it, here is the results:

 ![Screenshot (165)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/f/3bfa4d3168a5a812c8fc89a7da93613a9fac7eb3.jpeg)

---

<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:** [February 6, 2024, 5:00pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/13 "2024-02-06T17:00:15Z")

</div>

Hold on, hold on.

You actually get it to _hover_ **and** _display_ the tooltip?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/9/809d2af52f45511c26c9a29df11580320442c0f4.jpeg)

You just cannot click it? Neat. Does it visually go down, like the hover states would suggest?

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 5:01pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/14 "2024-02-06T17:01:51Z")

</div>

Correct, just cant be clicked. Sorry what do you mean by does it visually go down?

---

<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:** [February 6, 2024, 5:11pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/15 "2024-02-06T17:11:31Z")

</div>

Buttons have states:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/8/228a8b00705cc8b666aca65c19bc9030945af83a.png)

When you mash them, they enter said states, giving the user a visual clue as to whether they’re being used:

Does a default button do that?

* * *

So:

> the button in the UI element (it becomes inactive for some reason)

Which clearly is not the case since we can hover it. What is the button supposed to do that it’s not doing. It does not execute script?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/c/1dc5ccca0ad3da5627f34d4f4454ad581e1dea7d.png)

> I want to be able to click on the world without the UI elements buttons becoming inactive (Cannot not click on them).

How does it manifest, exactly? What is not happening?

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 5:39pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/16 "2024-02-06T17:39:46Z")

</div>

Heres a screen recording of the issue, hope this answers your question.

---

<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:** [February 6, 2024, 5:46pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/17 "2024-02-06T17:46:23Z")

</div>

Is this a regular native button? I must say that I have not seen behaviour like this before. Hard to imagine what could be causing it. Not even sure how to repro this.

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 5:47pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/18 "2024-02-06T17:47:28Z")

</div>

Yes

This one to be precise:

 ![Screenshot (166)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/e/42e27e24ff8d8b11ee6ecab706e02c38453f4b4d.png)

Then click logic:

 ![Screenshot (167)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/e/c0e969090b887f744526fe18089f9c7487dafb86.png)

---

<div class="post-metadata">

**Author:** ![EasyAL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EasyAL](https://forums.unrealengine.com/u/EasyAL)\
**Post date:** [February 6, 2024, 5:49pm UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/19 "2024-02-06T17:49:29Z")

</div>

Would you be interested in viewing the project for yourself? Ive got it on Github.

---

<div class="post-metadata">

**Author:** ![arybak89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@arybak89](https://forums.unrealengine.com/u/arybak89)\
**Post date:** [April 5, 2024, 1:10am UTC](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128/20 "2024-04-05T01:10:21Z")

</div>

You ever figure this out? I ran into the same issue in unreal 5.0.

[Next page](https://forums.unrealengine.com/t/ui-buttons-become-inactive-after-clicking-world/1670128.md?page=2)
