Blueprint Local Variables are Unique?

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

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.

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.

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.

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.

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

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

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!

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

“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?

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,

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!

Thanks for information !

:slight_smile:

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

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.

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!

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!

Thank you for information !!

Regards!

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:

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

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?

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)