# Activate button with key

**URL:** <https://forums.unrealengine.com/t/activate-button-with-key/473267>\
**Category:** UI\
**Tags:** button, activate, unreal-engine, Blueprint, question\
**Created:** [October 21, 2020, 5:22pm UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267 "2020-10-21T17:22:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 21, 2020, 5:22pm UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/1 "2020-10-21T17:22:52Z")

</div>

Hello,

I am trying to activate the animation from a mesh during gameplay with keyboard button (Interact = “E”), when the player is inside the trigger box (checked by blueprint).  
I am trying for some time now to be able to press the key and activate the blueprint without succes.

Can anyone help me with what I am doing wrong?

If I call the blueprint with another one it’s working. The problem is that this blueprint is not working by it’s own.

Thanks a lot!

 ![319542-bp-03.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/e/8cef2f2c8d442788db50ddff8b25ed2545ae4c7c.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 21, 2020, 7:50pm UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/2 "2020-10-21T19:50:38Z")

</div>

Did you enable input on the button?

 ![319550-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/c/cecdcb72a97bdfc85cb7ec81ff8052311b241a1b.jpeg)

---

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 22, 2020, 7:12am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/3 "2020-10-22T07:12:07Z")

</div>

Hi,  
Thank you for your answer.

This was the problem! Wow, didn’t expect something so hidden in the menus just for this simple problem. I will keep it in mind for the next buttons 🙂

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2020, 7:25am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/4 "2020-10-22T07:25:32Z")

</div>

I think you will find the button can be activated from any distance…

---

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 22, 2020, 8:22am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/5 "2020-10-22T08:22:37Z")

</div>

I have a condition in blueprint to work only when I am inside the trigger box.  
And it’s working fine but I found another problem: (see below)

---

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 22, 2020, 8:24am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/6 "2020-10-22T08:24:11Z")

</div>

In my scene I have more buttons like this (see picture attached)

After doing what you mentioned (in button B blueprint), seems like the other buttons in scene are deactivated. How can I enable this to work independently for all the buttons?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2020, 8:47am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/7 "2020-10-22T08:47:32Z")

</div>

The problem is, you’re not specifically sending the E event to the actor in question, you’re calling it globally.

The classic way to approach this problem is with line trace and blueprint interfaces. It will take a while to get sorted out, but once you have it, all the rest of your interactions will be trivial.

Do you need more info?

---

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 22, 2020, 9:01am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/8 "2020-10-22T09:01:15Z")

</div>

I am trying now to get the line trace approach, as you are mentioning is good.

The problem with line trace is that I can’t activate the function called in player event graph. See picture attached.

Thank you for trying to help me. It looks like a simple problem but it’s getting me headaches… 🙂

 ![319623-line-trace.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/3/c/c3c2f3744bbb370c5ea54b53478ebd56f237d12a.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2020, 10:27am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/9 "2020-10-22T10:27:39Z")

</div>

It basically looks ok, but in the button BP replace the interact event with a plain custom event which you call from the trace.

You’re already starting to see why people use BP interface, it’s to avoid all this casting!

If you have several hundred objects that can be interacted with, you can see this is not the way to go.

Once you have to BPI setup, you can just say to any actor ‘you have been clicked’. It’s then up to the actor to respond, if at all.

EDIT: Sorry, you did do that first part. What happens when you call the custom event in the button? Is the cast succeding?

---

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 22, 2020, 11:36am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/10 "2020-10-22T11:36:10Z")

</div>

When I call the custom event, nothing happens. I don’t know if I am missing something in one of the BP.

 ![319649-butonc-bp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/d/58dde6f7a7b59fccad5d2b896105b3786914ee17.jpeg)

 ![319650-player-bp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/9/f/69f0f694c1521d1dc45a37d02ef2b90ccbdc0379.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2020, 11:50am UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/11 "2020-10-22T11:50:31Z")

</div>

If all you changed is the name of the node, then the cast is failing.

---

<div class="post-metadata">

**Author:** ![ghimpster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ghimpster](https://forums.unrealengine.com/u/ghimpster)\
**Post date:** [October 22, 2020, 1:30pm UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/12 "2020-10-22T13:30:44Z")

</div>

After looking in depth at the problem I found what was the couse of it.

It was something related to the collision boxes around. There was another object collision box _in front of the collision box of the button_ that was causing the linetrace not to hit the button.  
After I managed to discover this and fix it, it’s working how it supposed. See picture attached after fix. It’s good to know for future.

Thank you for helping me out!  
I’ll have other questions, but I will post them in another thread.

 ![319657-collisions.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/5/3455847d9cfff053e51c404e0f7ccee3c9d8eb55.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2020, 1:48pm UTC](https://forums.unrealengine.com/t/activate-button-with-key/473267/13 "2020-10-22T13:48:05Z")

</div>

Cool 8) …
