Blueprint Local Variables are Unique?

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.

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!

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!

@

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

That would be very helpful, thank you!

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

alt text

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.

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

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

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.

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

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!

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

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:

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