# how do I find out which ui element is under the cursor?

**URL:** <https://forums.unrealengine.com/t/how-do-i-find-out-which-ui-element-is-under-the-cursor/2669033>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [October 27, 2025, 3:07pm UTC](https://forums.unrealengine.com/t/how-do-i-find-out-which-ui-element-is-under-the-cursor/2669033 "2025-10-27T15:07:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![228Arseniy228](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@228Arseniy228](https://forums.unrealengine.com/u/228Arseniy228)\
**Post date:** [October 27, 2025, 3:07pm UTC](https://forums.unrealengine.com/t/how-do-i-find-out-which-ui-element-is-under-the-cursor/2669033/1 "2025-10-27T15:07:41Z")

</div>

how do I find out which ui element is under the cursor?

---

<div class="post-metadata">

**Author:** ![BRGEzedeRocco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brgezederocco/32/1216890_2.png) [@BRGEzedeRocco](https://forums.unrealengine.com/u/BRGEzedeRocco)\
**Post date:** [October 27, 2025, 5:19pm UTC](https://forums.unrealengine.com/t/how-do-i-find-out-which-ui-element-is-under-the-cursor/2669033/2 "2025-10-27T17:19:30Z")

</div>

Hi @228Arseniy228 ,

I’m not sure if I’m fully understanding what you’re trying to do, but here’s something that might help.

When you use **“Show Mouse Cursor”** and **“Set Input Mode UI Only”** , switches the player’s input from controlling the character to controlling the **2D UI widgets** on the screen. This lets you hover and click on buttons, menus, etc.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/c/9cc7e8b2dad6fcdd257ede8384bc983e99eadebd.png)

When you use **“Show Mouse Cursor” (unchecked)** and **“Set Input Mode Game Only”** , it does the opposite , hides the cursor and returns full control to the **player character**.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/e/ebe28d9b76a1f88fb09770f3f1440990b1329def.png)

If what you want is to interact with a **3D UI (widgets in the world)**, you can use **“Press Pointer Key”** and **“Release Pointer Key”** from the **Widget Interaction Component** , which simulate mouse clicks in 3D space.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/b/d5b4c6f9a44b7c4fa72599e79c5bfb28f272f95c.png)  
here’s a video that explains it in more detail

- [https://www.youtube.com/watch?v=\_tpgGhtirT0](https://www.youtube.com/watch?v=_tpgGhtirT0)

If none of these solutions work, could you please explain a bit more about what you’re trying to achieve?  
Hope it helps!

---

<div class="post-metadata">

**Author:** ![228Arseniy228](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@228Arseniy228](https://forums.unrealengine.com/u/228Arseniy228)\
**Post date:** [October 27, 2025, 6:16pm UTC](https://forums.unrealengine.com/t/how-do-i-find-out-which-ui-element-is-under-the-cursor/2669033/3 "2025-10-27T18:16:17Z")

</div>

hi. I want to open the inventory. hold down the slot with the left mouse button and move it

---

<div class="post-metadata">

**Author:** ![BRGEzedeRocco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brgezederocco/32/1216890_2.png) [@BRGEzedeRocco](https://forums.unrealengine.com/u/BRGEzedeRocco)\
**Post date:** [October 27, 2025, 8:09pm UTC](https://forums.unrealengine.com/t/how-do-i-find-out-which-ui-element-is-under-the-cursor/2669033/4 "2025-10-27T20:09:23Z")

</div>

Okey i understand ,you will need to override the function On Drag Detected

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/6/6f6579cfbd6994963befc76d24d532851dc3cbc1.png)

> [@On a UMG Button, how to handle DragDrop functionality while retaining OnClicked functionality?](https://forums.unrealengine.com/t/on-a-umg-button-how-to-handle-dragdrop-functionality-while-retaining-onclicked-functionality/470375/5):
>
> Thank you both for your quick replies. I ended up using something very similar to Zhi Kang Shao’s solution, but I read both answers and incorporated both of your input into mine. This is what worked for me. The HUD/Grid widget, which is basically just a 12x12 UniformGridPanel of custom buttons: [311612-ue-forum-answer-grid.png] The UniformGridPanel had to be set to Visible in order for OnDrop to work. Also, the custom buttons are all Visible. Everything else is “Not Hit-Testable (Self Onl…

or On Mouse Button Down

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/2/3/3236f27c421ea5ca08b4866e85b3ab3713819856.png)

> [@Inventory Slot with Click & Drag n Drop functionality](https://forums.unrealengine.com/t/inventory-slot-with-click-drag-n-drop-functionality/2446230/11):
>
> I’d do it like this: Try it, see if that delivers. Do you need to Branch there? Because slot click would be implemented in the Slot widget and trigger on its mouse down.

In this [video](https://www.youtube.com/watch?v=v94b-yp3Umw&list=PL4G2bSPE_8umjCYXbq0v5IoV-Wi_WAxC3&index=10), the process of creating a **drag and swap item system** is explained. I recommend watching the entire series, as it does a great job of breaking down how to build a complete **inventory system** , or you can use it as a reference for what you’ve already created.

This documentation can also help you better understand how the **drag-and-drop system** works in Unreal.

> **[Creating Drag and Drop UI in Unreal Engine | Unreal Engine 5.7 Documentation...](https://dev.epicgames.com/documentation/en-us/unreal-engine/creating-drag-and-drop-ui-in-unreal-engine)**
>
> Shows how you can create drag and droppable UI widgets with UMG.

I think with this, you should be able to achieve what you were looking for.
