# Blueprint Local Variables are Unique?

**URL:** <https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329>\
**Category:** Blueprint\
**Tags:** unreal-engine, bug-report, Blueprint, question\
**Created:** [July 3, 2014, 4:26pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329 "2014-07-03T16:26:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitecon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nitecon](https://forums.unrealengine.com/u/Nitecon)\
**Post date:** [July 3, 2014, 4:26pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/1 "2014-07-03T16:26:42Z")

</div>

Currently I’m working on 2 functions both of which use Camera boom. Part of cleaning code up and making blueprint much more readable (code readability is important. even if its wires) I started creating local setters of input function variables, but they appear to be unique is this a bug or implemented this way for a reason? Maybe for DRY?

To better explain situation consider following:

**Function 1:**

_ **Input** _ Spring Arm Component (Named in blueprint function input params to Camera Boom)

Inside function I add a local variable (Local Zoom) then feed Function input to setter, so I can re-use it in multiple places later without having wire lines everywhere.

Function 1 works fine with local variables and everything is nice and tidy.

**Function 2:**

_ **Input** _ Sprint Arm Component (Named in blueprint function input params to Camera Boom) ← This name doesn’t need to be unique which strikes me as odd at this point…

So I do same thing as above and create a local variable called (Local Boom) Error shows up saying another function is currently using this variable. This does not make any sense as “Local Zoom” in function 1 is a local variable and out of scope.

I’d be happy to report a bug if this is truly a bug but I want to make sure I’m not missing something there for obvious reasons.

 ![9554-function1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/a/7/da7ac6db3fb8933d5366399a1949f1abfee7e2d5.png)

Added screenshot as requested and cropped it a bit since it was crazy big. In left variables panel you can see it is a local variable. When trying to create any other function with a local variable of Local Boom for instance it will fail.

---

<div class="post-metadata">

**Author:** ![DJMidKnight](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DJMidKnight](https://forums.unrealengine.com/u/DJMidKnight)\
**Post date:** [July 3, 2014, 5:11pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/2 "2014-07-03T17:11:27Z")

</div>

Sounds pretty straight forward for fun can you show a screenshot of your blueprint?

---

<div class="post-metadata">

**Author:** ![Nitecon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nitecon](https://forums.unrealengine.com/u/Nitecon)\
**Post date:** [July 3, 2014, 5:44pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/3 "2014-07-03T17:44:13Z")

</div>

Done. Is it just me or does this appear to be a bug? Seems like blueprints are reading local variables for functions at a global level, which would be bad once project gets really complex.

---

<div class="post-metadata">

**Author:** ![DJMidKnight](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DJMidKnight](https://forums.unrealengine.com/u/DJMidKnight)\
**Post date:** [July 3, 2014, 6:23pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/4 "2014-07-03T18:23:39Z")

</div>

I have had this issue sometimes happening with a variable that I changed name and then went to create a new one with same name as old one and it saying that variable already existed.

So it could perhaps be a buggy but if you haven’t tried closing blueprint and trying again or completely closing project and seeing if it is still doing it. Then if it still is acting that way I would say go for a bug report.

---

<div class="post-metadata">

**Author:** ![Nitecon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nitecon](https://forums.unrealengine.com/u/Nitecon)\
**Post date:** [July 3, 2014, 6:29pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/5 "2014-07-03T18:29:35Z")

</div>

Rebooted my machine while going to a meeting I’ll check if that works when I get back. Thanks @DJMidKnight

---

<div class="post-metadata">

**Author:** ![Nitecon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nitecon](https://forums.unrealengine.com/u/Nitecon)\
**Post date:** [July 3, 2014, 8:08pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/6 "2014-07-03T20:08:04Z")

</div>

Doesn’t work ☹ Even after a full machine reboot still same thing. Oh well bug report time. Thanks for help @DJMidKnight

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [July 3, 2014, 8:13pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/7 "2014-07-03T20:13:30Z")

</div>

Hey Nitecon,

I’m taking a look into this and I’m already seeing same behavior. No need to make a new post, I’ll track issue here. I’m going to talk to developers and see whether this is intended or not, and I will let you know what they say. It may not be until after holiday weekend, however. Thanks!

---

<div class="post-metadata">

**Author:** ![Nitecon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nitecon](https://forums.unrealengine.com/u/Nitecon)\
**Post date:** [July 3, 2014, 8:18pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/8 "2014-07-03T20:18:44Z")

</div>

Thanks @ , I didn’t create a new post just moved it to this section, I’m not a big fan of duplicate documentation.

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [July 3, 2014, 8:28pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/9 "2014-07-03T20:28:52Z")

</div>

“So I do same thing as above and create a local variable called (Local Boom) Error shows up saying another function is currently using this variable. This does not make any sense as “Local Zoom” in function 1 is a local variable and out of scope.”

I’ve seen this too, I was not sure what to make of it!

Is there some sort of shared namespace for local variables? how are they truly local if this is case?

---

<div class="post-metadata">

**Author:** ![Nitecon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nitecon](https://forums.unrealengine.com/u/Nitecon)\
**Post date:** [July 9, 2014, 6:33pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/10 "2014-07-09T18:33:25Z")

</div>

Any update to this @ ? Would be nice to find out if it’s either a bug that will be worked in future of whether it is this way by design and that we should be following a specific use case.

Thanks,

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [July 9, 2014, 10:27pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/11 "2014-07-09T22:27:06Z")

</div>

Hey Nitecon,

I apologize for delay in response. This is in fact a bug, and it appears to no longer be an issue in our internal build. I know that it is fixed for 4.4, and I am checking now to see if it is fixed in 4.3 which should be available very soon. I will let you know once I have confirmed. Thanks for your report!

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [July 9, 2014, 10:35pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/12 "2014-07-09T22:35:59Z")

</div>

Thanks for information !

🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [July 9, 2014, 10:56pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/13 "2014-07-09T22:56:43Z")

</div>

I can confirm that this should be working in 4.3 as well, so you shouldn’t see this problem after updating. Thanks!

---

<div class="post-metadata">

**Author:** ![Wolfsblut\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wolfsblut\_1](https://forums.unrealengine.com/u/Wolfsblut_1)\
**Post date:** [September 5, 2014, 4:44am UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/14 "2014-09-05T04:44:31Z")

</div>

4.4.1 and still not fixed?

Function1 → local var: test (float)  
Function2 → local var: test (int) → automatic same type as in function 1 (float) and type can not be changed. If you delete local var in function 2 it will tell you that it is still in use - if you force delete it will delete all get and set notes in function 1, but var definition itself will not be deleted in function 1.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [September 9, 2014, 5:53pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/15 "2014-09-09T17:53:17Z")

</div>

It looks like you are correct. What was fixed was an issue in which Function inputs and outputs were displaying same behavior, but Local Variables still have this problem. I have entered a bug report in our database (TTP# 346132) for our developers, and I will let you all know when I see an update with it. Thanks for pointing out that this is still occurring!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [September 26, 2014, 5:54pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/16 "2014-09-26T17:54:40Z")

</div>

This has been fixed internally and should appear in 4.5. Let us know if it still appears after 4.5 is released. Thanks for your patience!

---

<div class="post-metadata">

**Author:** ![Wolfsblut\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wolfsblut\_1](https://forums.unrealengine.com/u/Wolfsblut_1)\
**Post date:** [September 26, 2014, 7:08pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/17 "2014-09-26T19:08:39Z")

</div>

Thank you for information !!

Regards!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8c742bcf1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8c742bcf1](https://forums.unrealengine.com/u/anonymous_user_8c742bcf1)\
**Post date:** [November 5, 2014, 8:57pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/18 "2014-11-05T20:57:55Z")

</div>

I just tried a large BP in 4.5 now and I can confirm, issue is still there, It is not fixed. More info about my case:

> **[\[Bug\] Cannot use same Local Variable name twice in two functions!](https://forums.unrealengine.com/questions/94965/bug-cannot-use-same-local-variable-name-twice-in-t.html)**
>
> Try to use a Local Variable in a blueprint function and then create another function using that same name for another local variable. The system will not allow this.

Also I mentioned a _somewhat_ workaround over there, Plus another possible bug related to this.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [November 5, 2014, 9:13pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/19 "2014-11-05T21:13:28Z")

</div>

I just tested this in 4.5.1 and I was not able to reproduce issue. Make sure when you are checking Functions for Local Variables that you are in Graph for function, or Local Variables will not appear. Can you be more specific about steps you take to reproduce issue? Are you able to reproduce issue in a new project?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8c742bcf1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8c742bcf1](https://forums.unrealengine.com/u/anonymous_user_8c742bcf1)\
**Post date:** [November 5, 2014, 9:28pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/20 "2014-11-05T21:28:01Z")

</div>

latest version I have is 4.5.0, and I just tested with a new project, issue is there. repro steps:

1. Create a new project (I did based on Blueprint Blank, and without starter content to have simplest project possible)
2. Create a new bleuprint.
3. Create a function called GetValue1.
4. Add a local variable in this function called TempVal of type Integer, and use it in function (I just added value by 2 and returned it).
5. Create another function called GetValue2.
6. Add a local variable in new function and call it TempVal.

variable’s type property in details page turns gray \* moment\* you hit enter on name of variable. And therefor you can’t change type to say vector, or anything for that matter. bug is clearly there because you still haven’t started using this new variable and so engine should allow you modifying its type.

Again, we can use workaround I mentioned in other thread, linked above, but I’m not sure if it confuses engine or not (more info, my posts over here: [[Bug] Cannot use same Local Variable name twice in two functions! - Blueprint - Epic Developer Community Forums](https://answers.unrealengine.com/questions/94965/bug-cannot-use-same-local-variable-name-twice-in-t.html))

[Next page](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329.md?page=2)
