# Blueprint Local Variables are Unique?

**URL:** <https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329>\
**Category:** Blueprint\
**Tags:** unreal-engine, bug-report, question, Blueprint\
**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:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [November 6, 2014, 12:57am UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/21 "2014-11-06T00:57:56Z")

</div>

This is not only issue regarding local variables, but I believe problem is related also to local scope issues that I have been seeing as well.

---

<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 6, 2014, 8:32pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/22 "2014-11-06T20:32:37Z")

</div>

It appears this is a slightly different issue than one we initially reported in TTP 346132, though I would have thought that would fix issue. I have verified that this occurs as you describe, and entered a new bug for it (UE-5137). I will let you know when I see it updated.

In meantime, your workaround of changing type before naming local variable is a good one. Thanks for that!

---

<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 6, 2014, 8:33pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/23 "2014-11-06T20:33:59Z")

</div>

If you are seeing separate issues with local variables that are related to using same name between different functions, please let me know here. If you see issues that are not related to that, please open a new post in Bug Reports section so we can investigate it there. Thanks!

---

<div class="post-metadata">

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

</div>

@

Yes, when I create an Actor Class BP and have multiple functions using local vars with same name, will continuously overwrite each other when called in succession. (Daisy chained function nodes.) Unfortunately, I have deleted that graph already, but I could recreate and post if you need a screen shot.

Regards

---

<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 6, 2014, 10:02pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/25 "2014-11-06T22:02:16Z")

</div>

That would be very helpful, thank you!

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [November 7, 2014, 3:42am UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/26 "2014-11-07T03:42:34Z")

</div>

So image for worldclock\_complete is entire process working properly before I tried breaking it down into functions.

function is created to take two time values (secs/mins) or (mins/hours) as ints along with a third value that is essentially serves as a denominator. (How many secs is one min, how many min is one hour). I pass these in, and immediately assign them to local variables. Not only do my variables receive out of scope error, but because they are being read as out of scope, rest of function is not firing properly internally, and is simply triggering straight through instead.

![20337-worldclock_function_1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/7/6a7f1690775894b6836a0b30ddafd81703c2b001.png)

 ![20352-worldclock_complete.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/7/7b71346c8203b32d8ff516d333543855ff8f235a.png)

alt text

---

<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 7, 2014, 3:38pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/27 "2014-11-07T15:38:32Z")

</div>

I’m not certain I understand. It looks like you’re using one function with 3 local variables, and using function multiple times. Each time function is called, those variables are set to new values you give them. Are you expecting something different?

issue described in this post are regarding local variables that have same name in different functions. I don’t see that happening in your example.

---

<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 7, 2014, 3:40pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/28 "2014-11-07T15:40:51Z")

</div>

I moved this down into its own answer for now, as it’s getting difficult to read.

---

<div class="post-metadata">

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

</div>

I know it is hard to see, but problem is that local vars are NOT being set to new values each time. They are considered “Out of Scope” ( see image 4) even though they are local vars. Because they are out of scope, they are blowing straight through IF branch inside function as if it didn’t exist because they are not being assigned. conditional check on If branch never fires(iUnitA%iUnitLen).

What SHOULD be happening in this chain is that minutes updates at a 1:10 ratio to seconds, and hours updates at a 1:24 ration to minutes. When secs reach 10 they should reset to zero, and when mins reach 24 they should reset to zero. Instead what is happening is that Hours are increment every pulse(second) while Seconds and Minutes are never updated at all or if they are actually being updated they are set to 0 every pulse.

As for local vars with same name, I can’t speak for OP but it won’t even allow me to name local vars same as local vars in parent class or a different function, which should be evidence enough that scope isn’t being respected.

![20431-worldclock_function_5.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/b/a9b9ab877417484422ace95fa13767635f64c0c6.png)

---

<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 7, 2014, 6:55pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/30 "2014-11-07T18:55:38Z")

</div>

Okay, that all seems like a separate issue. Please take information you posted here and create a new post in Bug Reports section, and post a link to new question here. I’ll be taking a look into it, but having it in its own topic allows us to track it better. Thanks!

Not being able to name local var same as another variable in BP is related, however. I’m going to either update existing bug or create a new one for that.

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [November 7, 2014, 7:00pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/31 "2014-11-07T19:00:07Z")

</div>

Sure thing. And damnit man but you respond quick 😛 LOL Thanks for fast update. I’ll toss a new question up here in a minute.

---

<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:** [December 10, 2014, 11:48pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/32 "2014-12-10T23:48:01Z")

</div>

Hi all,

There were a number of local variable issues that were addressed with a number of changes recently, and I can verify that this particular issue has been fixed internally. It should appear in 4.7. Thanks for reports!

---

<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:** [December 11, 2014, 4:35am UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/33 "2014-12-11T04:35:00Z")

</div>

, could you please provide a link to follow up answer?

---

<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:** [December 11, 2014, 5:03pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/34 "2014-12-11T17:03:14Z")

</div>

Hi Wolfsblut,

What follow up answer? Do you mean other issue with watching variables that RAVaught was going to open a post for? That can be found here:

> **[Local Variables "Out of Scope" and not firing on conditionals](https://forums.unrealengine.com/questions/129913/local-variables-out-of-scope-and-not-firing-on-con.html)**
>
> This bug thread is created based on conversation here: \[Blueprint Local Variables are Unique? - Blueprint - Epic Developer Community Forums\]\[1\] During testing for a bug on scope of local variables, I created a function that takes three integer...

---

<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:** [December 11, 2014, 7:34pm UTC](https://forums.unrealengine.com/t/blueprint-local-variables-are-unique/287329/35 "2014-12-11T19:34:18Z")

</div>

, never mind. I overlooked RAVaughts comment. I actually thought there was something I missed on original question.

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