# Click on actor = display a widget

**URL:** <https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574>\
**Category:** UI\
**Tags:** billboard, unreal-engine, Widget, UE4, Blueprint, question\
**Created:** [October 21, 2017, 12:12pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574 "2017-10-21T12:12:10Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dinfante](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dinfante](https://forums.unrealengine.com/u/Dinfante)\
**Post date:** [October 21, 2017, 12:12pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/1 "2017-10-21T12:12:10Z")

</div>

Hi! First of all, I’m fairly new to this, so the solution might be right in front of me but I can’t see it. The thing is, I have tried everything to make this work but I can’t seem to achieve it.

I have an actor, which is a billboard image with a collision sphere around it, just like this:

 ![217444-actorissue.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/2/f72879a2ca72d03707efea76c4038f2cdab1fee6.jpeg)

And I also have a widget with a text message and a button to close it.

In my scene, I have various of these actors (number 1, 2, 3, etc.) around, and my intention is to be able to click on them and display the widget (each actor would display a different widget), no matter how far or close thay are, as soon as I can see them (not whitin an area, just anywhere).

I guess It is possible, but I just can’t make the actor clickable.

Thanks in advance!

---

<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:** [October 21, 2017, 12:46pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/2 "2017-10-21T12:46:35Z")

</div>

The most straightforward way to do it, is to override the actor’s onClicked:

 ![217457-onclicked.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/3/c43e7fd0818b08c89a21ba7c39c19875632ab9ea.png)

If you want to specifically use the trigger for it, select it and:

![217459-trigger.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/7/0d7930c4964b9317009619511d073ed24410cfd4.png)

And enable click events in the controller:

![217458-controller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/a/10aad628de417cf1c096ea94452ebc3fec80b04f.png)

---

<div class="post-metadata">

**Author:** ![Dinfante](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dinfante](https://forums.unrealengine.com/u/Dinfante)\
**Post date:** [October 21, 2017, 1:16pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/3 "2017-10-21T13:16:20Z")

</div>

Thank You!! It worked! What I was lacking was a a custom player controller with the click events enabled. With it activated, clicking on the collision sphere works like a charm 🙂

---

<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:** [October 21, 2017, 3:08pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/4 "2017-10-21T15:08:37Z")

</div>

That’s great. If it’s working as intended now, consider flagging this issue as answered

---

<div class="post-metadata">

**Author:** ![Aros\_Prince](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Aros\_Prince](https://forums.unrealengine.com/u/Aros_Prince)\
**Post date:** [October 30, 2020, 12:02pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/5 "2020-10-30T12:02:10Z")

</div>

Hi, why exactly do i need a custom player controller? What I did was this:

 ![320592-playercontroller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/8/6883e20ffb7de5546aa8c2e61dea489a93c236a0.png)

But it doesn’t work. The event in the actor does not get called.

---

<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:** [October 30, 2020, 12:13pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/6 "2020-10-30T12:13:08Z")

</div>

You do not need a custom controller - what you have is fine. The onClick is using Blocked Visiblity channel. Could you share the collision setup of the actor you’re clicking on?

---

<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:** [October 30, 2020, 12:19pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/7 "2020-10-30T12:19:23Z")

</div>

To clarify, here’s _the very minimum_ that you will need for this kind of click to work:

 ![320593-screenshot-2020-10-30-121758.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/6/76672468a3914abbe2bea810f81fee10963fa327.jpeg)

- something with collision
- enabled `Click Events` in the Player Controller
- at least `Collision Enabled` → `Query Only`
- blocking `Visibility Trace Response`
- no widgets in the way

---

<div class="post-metadata">

**Author:** ![Aros\_Prince](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Aros\_Prince](https://forums.unrealengine.com/u/Aros_Prince)\
**Post date:** [October 30, 2020, 1:52pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/8 "2020-10-30T13:52:04Z")

</div>

Thanks for the response.

That does not help. It must be something wrong with the controller…

I created a new clean blank project and in that project, it works even with the default collision settings:

![320595-collision.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/e/f7ecbac72f73ca1eb7a542c078b51414e82a0439.png)

But in this project it does not work for any actor no matter what I set. The level has a default settings as well though, there are just a bunch of static mesh actors and instances of the actor I am trying to make clickable.

Will go over my C++ code if there isn’t anything breaking it. But the thing is that the code should not kick in this basic level…

---

<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:** [October 30, 2020, 2:23pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/9 "2020-10-30T14:23:52Z")

</div>

> the default collision settings:

It will work with defaults, sure - I just wanted to highlight the very minimum that’s needed in case you wanted to trim things down.

> I created a new clean blank project  
> and in that project, it works even  
> with the default collision settings:

What is the element that has the collision? Is there one? You’re showing settings of the root here which has no collision of its own. You need a component that can block visibility response; no components = no collision…

Can you show the actor hierarchy?

---

<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:** [October 30, 2020, 2:28pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/10 "2020-10-30T14:28:21Z")

</div>

You could also start testing it like so:

 ![320605-screenshot-2020-10-30-142532.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/2/142cbcee7789b3025426e51d370623fb5f9d2991.jpeg)

Or you could line trace from the camera towards the cursor.

But the basic actor onClick is reliable enough providing nothing else gets in the way and the interactive element’s screenspace size is larger than a pixel. Clicking on tiny things can get annoying.

Do note that the actor components can implement their own click events if needed:

![320606-screenshot-2020-10-30-143035.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/5/4/4542ec37170bb14ed7ef72d0f1ae771b79fe7eab.jpeg)

---

<div class="post-metadata">

**Author:** ![Aros\_Prince](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Aros\_Prince](https://forums.unrealengine.com/u/Aros_Prince)\
**Post date:** [October 30, 2020, 3:19pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/11 "2020-10-30T15:19:33Z")

</div>

I am sorry, yes I posted a wrong screenshot. But anyway that was not the point. I have figured out what was the problem.

In the project settings, there is a “Use Mouse for touch” option which in my case was set to true. Disabling the option did the trick.

Anyway touch support in UE (at least on Windows) is still terrible. We do have issues with it all the time.

But on this project, I don’t need touch screen support so I think I will just keep it disabled.

Thanks for all your help!

---

<div class="post-metadata">

**Author:** ![Kunnzkk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kunnzkk](https://forums.unrealengine.com/u/Kunnzkk)\
**Post date:** [May 29, 2022, 1:07pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/12 "2022-05-29T13:07:13Z")

</div>

Thank You!

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [October 3, 2022, 9:01pm UTC](https://forums.unrealengine.com/t/click-on-actor-display-a-widget/407574/13 "2022-10-03T21:01:03Z")

</div>

Would it be ok to assume that for “use mouse for touch” or on touch devices we could use “GetHitResultUnderFingerForObjects” and “GetHitResultUnderFingerByChannel”?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/4/98471e8240218dc0f901bc5a668d874094723c04.png)
