# Getting actor when clicking on the mesh

**URL:** <https://forums.unrealengine.com/t/getting-actor-when-clicking-on-the-mesh/340654>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 6, 2015, 11:16am UTC](https://forums.unrealengine.com/t/getting-actor-when-clicking-on-the-mesh/340654 "2015-12-06T11:16:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rebel\_Camp\_Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rebel\_Camp\_Games](https://forums.unrealengine.com/u/Rebel_Camp_Games)\
**Post date:** [December 6, 2015, 11:16am UTC](https://forums.unrealengine.com/t/getting-actor-when-clicking-on-the-mesh/340654/1 "2015-12-06T11:16:51Z")

</div>

Hi,

for my item/inventory system I need to handle clicking on the item in the world, so it adds the clicked item to the inventory.

How do I handle clicking on an item actor so it returns the clicked item actor to store in a variable? I need the Item in a variable so I can add it to the inventory array.

I found something about Onclicked.AddDynamic and then enable mouse events in the player controller but I don’t know how to do this. How do I enable mouse events in the controller and where do I put the OnClicked.AddDynamic? in the player controller or in the Item class?

Any help would be greatly appreciated!
