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 the Camera boom. Part of cleaning the code up and making the blueprint much more readable (code readability is important. even if its wires) I started creating local setters of the 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 the situation consider the following:
Input Spring Arm Component (Named in the blueprint function input params to Camera Boom)
Inside the function I add a local variable (Local Zoom) then feed the Function input to the 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.
Input Sprint Arm Component (Named in the 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 the 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 the “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 the screenshot as requested and cropped it a bit since it was crazy big. In the 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 the project gets really complex.
I have had this issue sometimes happening with a variable that I changed the name and then went to create a new one with the same name as the old one and it saying that the variable already existed.
So it could perhaps be a buggy but if you haven’t tried closing the blueprint and trying again or completely closing the 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 Even after a full machine reboot still the same thing. Oh well bug report time. Thanks for the help @DJMidKnight
I’m taking a look into this and I’m already seeing the same behavior. No need to make a new post, I’ll track the issue here. I’m going to talk to the developers and see whether this is intended or not, and I will let you know what they say. It may not be until after the holiday weekend, however. Thanks!
Thanks @Ben Halliday, 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 the 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 the “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 the case?
Any update to this @Ben Halliday? Would be nice to find out if it’s either a bug that will be worked in the future of whether it is this way by design and that we should be following a specific use case.
I apologize for the 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 the information Ben!
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 the same type as in function 1 (float) and the type can not be changed. If you delete the local var in function 2 it will tell you that it is still in use - if you force the delete it will delete all get and set notes in function 1, but the var definition itself will not be deleted in function 1.
It looks like you are correct. What was fixed was an issue in which the Function inputs and outputs were displaying the same behavior, but the 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 the information Ben!!
I just tried a large BP in 4.5 now and I can confirm, the 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 the issue. Make sure when you are checking the Functions for Local Variables that you are in the Graph for the function, or the Local Variables will not appear. Can you be more specific about the steps you take to reproduce the issue? Are you able to reproduce the issue in a new project?
The latest version I have is 4.5.0, and I just tested with a new project, the issue is there. The repro steps:
- Create a new project (I did based on Blueprint Blank, and without the starter content to have the simplest project possible)
- Create a new bleuprint.
- Create a function called GetValue1.
- Add a local variable in this function called TempVal of type Integer, and use it in the function (I just added the value by 2 and returned it).
- Create another function called GetValue2.
- Add a local variable in the new function and call it TempVal.
The variable’s type property in the details page turns gray the moment you hit enter on the name of the variable. And therefor you can’t change the type to say vector, or anything for that matter. The bug is clearly there because you still haven’t started using this new variable and so the engine should allow you modifying its type.
Again, we can use the workaround I mentioned in the other thread, linked above, but I’m not sure if it confuses the engine or not (more info, my posts over here: [Bug] Cannot use same Local Variable name twice in two functions! - Blueprint - Unreal Engine Forums)