# 2D Sprite On Clicked Event Not Consistent

**URL:** <https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705>\
**Category:** Asset Creation\
**Tags:** click-event, unreal-engine, onclicked, mouse-event, question\
**Created:** [July 4, 2018, 5:31pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705 "2018-07-04T17:31:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 5:31pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/1 "2018-07-04T17:31:06Z")

</div>

Hello Everyone,

I have a problem that’s really beginning to make me scratch the back of my skull.

My 2D sprites aren’t firing off the “On Clicked” event every time. I thought that maybe the sprite was too thin and it was having some problems because of that so I just added a collision box and still. It fires off every 2 or three clicks but not every click. What might be causing this?

 ![246218-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/3/2a3ec6c68e4a5c15ad3e17a8537502554ce54c71.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:** [July 4, 2018, 5:59pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/2 "2018-07-04T17:59:24Z")

</div>

Let me guess, it always fires on double-click, though, right?

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 6:05pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/3 "2018-07-04T18:05:53Z")

</div>

Yeah mostly, any ideas? And also, everytime I start the game. It never fails the first time I 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:** [July 4, 2018, 6:42pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/4 "2018-07-04T18:42:44Z")

</div>

Yeah, sounds about right. See if this helps:

 ![246219-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/9/e49cc4f585c666befb02d076c0ae17d8e34882ec.png)

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 7:23pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/5 "2018-07-04T19:23:23Z")

</div>

Checked my settings and had it just like you, except for the mouse lock mode but after changing it to match yours it didn’t help =(

---

<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:** [July 4, 2018, 7:24pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/6 "2018-07-04T19:24:11Z")

</div>

Do you have any widgets on the screen?

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 7:29pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/7 "2018-07-04T19:29:39Z")

</div>

Just my main HUD widget. However, I’m trying to click on a 2D sprite in the game.

---

<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:** [July 4, 2018, 7:31pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/8 "2018-07-04T19:31:56Z")

</div>

What could be happening is that a widget consumes the first click and that click is considered _handled_, in which case this click is not sent through to the player controller for further processing. This will make double clicking seem to work fine, for example.

Consider temporarily disabling widgets (do not create or add them to the screen), this might help you isolate the problem.

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 7:39pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/9 "2018-07-04T19:39:23Z")

</div>

I will try this and report back. Thanks for your suggestions!

---

<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:** [July 4, 2018, 7:50pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/10 "2018-07-04T19:50:38Z")

</div>

I’ll just add that I replicated your setup in a clean project, a single actor with a sprite + box collision set to block all dynamic, controller event clicks on. And it does seem work well, on my end at least.

Changing default viewport mouse capture mode to _Capture Permanently_ produced the inconsistent behaviour you initially described. Including _initial mouse down_ in the capture mode makes the collision box register every click correctly.

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 8:03pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/11 "2018-07-04T20:03:25Z")

</div>

After disabling the main HUD widget (The only one I have) it’s still doing 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:** [July 4, 2018, 8:14pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/12 "2018-07-04T20:14:55Z")

</div>

Can you create a new actor with a cube, drop in the same level and test its onClick-\>PrintString

_If I’m not mistaken, we’re dealing with a derived class here, right? Is there anything special about the parent?_ - ignore this, I misinterpreted your image.

Is there something in the construction script you might have forgotten about?

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 8:32pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/13 "2018-07-04T20:32:37Z")

</div>

I know you said to ignore, but I tried it anyway just to be on the safe side. I created a new cube and made it a blueprint actor. After that, I created a box collision and added the on clicked event to it with a print string. The same thing happens. I can get the first event great! But after that, it takes to clicks to fire off. The construction side I have empty.

---

<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:** [July 4, 2018, 8:43pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/14 "2018-07-04T20:43:39Z")

</div>

Hm, do you change the input mode anywhere in your project using one of those:

> **[Set Input Mode Game And UI](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Input/SetInputModeGameAndUI/)**
>
> Set Input Mode Game And UI

---

<div class="post-metadata">

**Author:** ![warhulk1745](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@warhulk1745](https://forums.unrealengine.com/u/warhulk1745)\
**Post date:** [July 4, 2018, 8:52pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/15 "2018-07-04T20:52:19Z")

</div>

![246237-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/e/49e3f5be000f810bc6bab6b87f38acddf2fa3354.jpeg)

Had this connected to Begin Play and as soon as I detached it, it started to work as expected! Thank you so much for your help!

---

<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:** [July 4, 2018, 8:55pm UTC](https://forums.unrealengine.com/t/2d-sprite-on-clicked-event-not-consistent/428705/16 "2018-07-04T20:55:26Z")

</div>

Wicked! There should be a tickbox under the upvote/downvote.

If in doubt, see here, second image:  
[https://answers.unrealengine.com/static/how-to-use-answerhub.html](https://answers.unrealengine.com/static/how-to-use-answerhub.html)

Good luck with the project!
