# Add a key function in editor

**URL:** <https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964>\
**Category:** Blueprint\
**Tags:** coding, unreal-engine, Blueprint, question\
**Created:** [March 28, 2020, 6:01am UTC](https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964 "2020-03-28T06:01:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gamzplayz101](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamzplayz101](https://forums.unrealengine.com/u/Gamzplayz101)\
**Post date:** [March 28, 2020, 6:01am UTC](https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964/1 "2020-03-28T06:01:03Z")

</div>

Hello  
I have been making my horror game for the past few months now and I just recently downloaded a blueprint for a light switch. In the editor under default settings, I noticed an option to select what key you want to use to be able to click on it.  
I want to add this feature to other objects but I cannot figure out how can someone please help me.  
Thank you

![298614-screenshot-86.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/d/65d91b9eafe09e6433d46c57a0438b4041741662.png)

---

<div class="post-metadata">

**Author:** ![ugmoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ugmoe](https://forums.unrealengine.com/u/ugmoe)\
**Post date:** [March 28, 2020, 7:06am UTC](https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964/2 "2020-03-28T07:06:52Z")

</div>

Create a new variable in your blueprint, set the variable type to “key”, compile, and set a default value

 ![298603-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/6/126aa1a17fefede43831e4fa40ca729ab2a674dd.png)

then click the eyeball icon

![298605-capture2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/4/ff4c0ea90ec806dc31af3c5b09a00061a3b9c867.png)

---

<div class="post-metadata">

**Author:** ![Gamzplayz101](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamzplayz101](https://forums.unrealengine.com/u/Gamzplayz101)\
**Post date:** [March 29, 2020, 9:35pm UTC](https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964/3 "2020-03-29T21:35:56Z")

</div>

Ok, but how would you incorporate that into your blueprint to make it do a function?

---

<div class="post-metadata">

**Author:** ![ugmoe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ugmoe](https://forums.unrealengine.com/u/ugmoe)\
**Post date:** [March 29, 2020, 10:03pm UTC](https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964/4 "2020-03-29T22:03:44Z")

</div>

from the blueprint panel, you can drag it onto your blueprint and click “get key”

or you can right-click on the blueprint and type “get key”

then do whatever you want with it

---

<div class="post-metadata">

**Author:** ![Gamzplayz101](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamzplayz101](https://forums.unrealengine.com/u/Gamzplayz101)\
**Post date:** [March 30, 2020, 2:24am UTC](https://forums.unrealengine.com/t/add-a-key-function-in-editor/462964/5 "2020-03-30T02:24:51Z")

</div>

I get the whole set and get key but what is an example of an implementation of it in a blueprint
