# How do I clear a variable?

**URL:** <https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142>\
**Category:** Editor Scripting\
**Tags:** Variable, actor, unreal-engine, null, Blueprint, question\
**Created:** [April 20, 2014, 5:07pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142 "2014-04-20T17:07:25Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_80025496](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_80025496](https://forums.unrealengine.com/u/anonymous_user_80025496)\
**Post date:** [April 20, 2014, 5:07pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/1 "2014-04-20T17:07:25Z")

</div>

Very sorry if this has been asked before, but I couldn’t find an answer.

How do I set a variable to nothing/nil/null/none etc?

Scenario: I set a variable on an actor when it collides with another actor, I want to clear that variable once it’s done colliding.

Thanks

---

<div class="post-metadata">

**Author:** ![ArcadeOrigins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ArcadeOrigins](https://forums.unrealengine.com/u/ArcadeOrigins)\
**Post date:** [April 20, 2014, 5:19pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/2 "2014-04-20T17:19:48Z")

</div>

You can try to set the variable without an input parameter ?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_80025496](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_80025496](https://forums.unrealengine.com/u/anonymous_user_80025496)\
**Post date:** [April 20, 2014, 5:33pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/3 "2014-04-20T17:33:01Z")

</div>

haha, yep, that was it. Simpler than I thought!

---

<div class="post-metadata">

**Author:** ![axelZellalex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@axelZellalex](https://forums.unrealengine.com/u/axelZellalex)\
**Post date:** [June 11, 2014, 9:49pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/4 "2014-06-11T21:49:50Z")

</div>

hey guys  
this didnt work for me  
im calling Set variable, and passing nothing but it wont work…  
am i missing something ?

---

<div class="post-metadata">

**Author:** ![Steve\_Allison](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Steve\_Allison](https://forums.unrealengine.com/u/Steve_Allison)\
**Post date:** [June 11, 2014, 10:14pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/5 "2014-06-11T22:14:17Z")

</div>

What type of variable are using?

---

<div class="post-metadata">

**Author:** ![axelZellalex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@axelZellalex](https://forums.unrealengine.com/u/axelZellalex)\
**Post date:** [June 13, 2014, 7:04pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/6 "2014-06-13T19:04:32Z")

</div>

im trying to set a reference to a Volume to None

---

<div class="post-metadata">

**Author:** ![Zeustiak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zeustiak](https://forums.unrealengine.com/u/Zeustiak)\
**Post date:** [June 13, 2014, 11:28pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/7 "2014-06-13T23:28:54Z")

</div>

Have one volume variable you use to store your volume. Then have another volume variable that is never set to anything. Us the second variable to set the first variable to None.

---

<div class="post-metadata">

**Author:** ![axelZellalex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@axelZellalex](https://forums.unrealengine.com/u/axelZellalex)\
**Post date:** [June 14, 2014, 9:11am UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/8 "2014-06-14T09:11:17Z")

</div>

that doesnt sound very good  
should i raise a request to have a None variable?

---

<div class="post-metadata">

**Author:** ![frederick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@frederick](https://forums.unrealengine.com/u/frederick)\
**Post date:** [February 15, 2016, 3:20pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/9 "2016-02-15T15:20:36Z")

</div>

I would like to know how to clear a reference variable too.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8ef379cd1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8ef379cd1](https://forums.unrealengine.com/u/anonymous_user_8ef379cd1)\
**Post date:** [July 10, 2016, 8:55pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/10 "2016-07-10T20:55:31Z")

</div>

Worked for me! Intuitively intuitive

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d30958d7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d30958d7](https://forums.unrealengine.com/u/anonymous_user_d30958d7)\
**Post date:** [August 6, 2016, 12:34am UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/11 "2016-08-06T00:34:18Z")

</div>

Precision: you need to connect an empty ‘make array’ node to the set array variable

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_67720dc8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_67720dc8](https://forums.unrealengine.com/u/anonymous_user_67720dc8)\
**Post date:** [July 17, 2018, 8:39pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/12 "2018-07-17T20:39:47Z")

</div>

This is an old thread but since there must still be some people here looking for answers, there is a workaround for this.

I’m guessing the problem lies with Actor references or something along those lines. The first answer from this thread was partly correct. When trying to clear a reference, you should set the variable without an input. This does clear the variable. But not entirely. There are still some traces left, for example the coordinates get reset to 0, 0,0.

To counter this, make a branch, type “==” and get the Equal(Object). Leave the select asset clear and the branch should be able to tell if the variable is in fact empty or not.

Good luck guys, this worked for me, hopefully for you guys too!

---

<div class="post-metadata">

**Author:** ![somethingstarted](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somethingstarted](https://forums.unrealengine.com/u/somethingstarted)\
**Post date:** [December 30, 2018, 9:48pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/13 "2018-12-30T21:48:47Z")

</div>

whoa. that’s a really friggen good idea!

---

<div class="post-metadata">

**Author:** ![Skylene](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skylene](https://forums.unrealengine.com/u/Skylene)\
**Post date:** [November 13, 2021, 1:31pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/14 "2021-11-13T13:31:10Z")

</div>

Thank you so much for this! I was having issues with my ANIM GRAPH where it would skip one state the second time I fired the animation loop.

My states were setup as → idle with bow equipped → aiming bow → charging bow → firing arrow → idle with bow equipped.

It worked the first time I tried to shoot an arrow, but when I tried again, it would skip past “charging bow” state and right to the “firing arrow” state. Turns out I had to set the boolean variable I used for checking if the arrow had been shot (is arrow shot?) to untrue again after the arrow was shot in my player controller bp and hook the “is arrow shot?” variable to == (equal) and leave the bottom variable of the equal to checked (true).

 ![352102-reset-variable.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/c/6dc3794d1bfe627e232127dd17ad44d5109d0a50.png)

 ![352104-transition-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/a/4ba86d21ff19d5db30bc91bd4f85f90cd51d0dfc.png)

 ![352105-transition-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/d/20d4e5a8fec0ddbb95e5703d9231c1262cad6ef3.png)

I attached some photoes incase this can help someone too!  
Took ages to find this fix for me 😃 So thanks again !

---

<div class="post-metadata">

**Author:** ![The\_KvaDRoniKuS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@The\_KvaDRoniKuS](https://forums.unrealengine.com/u/The_KvaDRoniKuS)\
**Post date:** [December 20, 2024, 5:34am UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/15 "2024-12-20T05:34:17Z")

</div>

ive found that there is CLEAR node to empty array

 ![изображение](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/0/a000a7d2e3be34c9bab423170ecb774b218dab79.png)

---

<div class="post-metadata">

**Author:** ![DieggoMasamune](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dieggomasamune/32/953152_2.png) [@DieggoMasamune](https://forums.unrealengine.com/u/DieggoMasamune)\
**Post date:** [May 20, 2025, 5:41pm UTC](https://forums.unrealengine.com/t/how-do-i-clear-a-variable/281142/16 "2025-05-20T17:41:58Z")

</div>

Thanks, one thing that worked for me was set the variable to “nothing” and then removed from parent later, it worked so far.
