Imagine creating two identical Unreal Engine projects and writing the same simple blueprint code in both. Sometimes the code works in one project but not in the other. I have reinstalled Unreal Engine, and I am using almost all default settings. I’d like to understand why this happens?
Are here possible timing issues here? Are you relying on things happening in a certain order on begin play? That could be it…
Hey there @BaZPT! Welcome back to the community! As Clockwork mentioned, depending on how the blueprint is implemented, it’s possible that it’s affected by other differences, such as time, updates to the template in the time between, defaults that have changed, etc. With some context to the blueprint itself, we may be able to provide a bit more personalized insight.
I have only a single function in a newly created project. The function can be called anywhere (begin play, tick, ‘input’…), no matter where. I don’t get any errors or warnings. Here is a basic example of what happens.
A=1
B=1
X= A+B (always = 0)
It doesn’t make sense.
Thank you for the answers, but I don’t think that’s the problem.
i think you’ll find that A and B are set to 0, default.
where are you setting them and are they local variables?
I appreciate your reply.
I think I might not have explained myself properly with my example.
What I meant with my example is that, I have two projects that are exactly the same, with the exact same blueprint, no alterations made, however while I run one of them with the example above of A=1 and B=1, meaning A+B=2 and it runs smoothly without issues, the other project doesn’t run the variable as desired.
I know how to set variables, and whenever there’s errors, I normally know how to solve it by rewriting the code, however when this starts happening it’s demotivating to remake the whole project all over again to find out that there were no mistakes, it was just the variable not running accordingly. Of course when we’re speaking of small projects, it’s easier to remake the project, but when we’re speaking of bigger projects it’s very demotivating to remake the whole project and blueprints and variables with it.
Has anyone else experienced this issue, and if so, how have you solved it?
If A and B are 1, then X will be 2, period
just put a breakpoint there, it’ll let you see exactly all the variables exactly when they are called
Don’t rely on the debugger, use a print string.
Do you mean that at some point the project appears to be corrupted and can no longer be fixed that you need to resort to recreating it?
I know this sounds like black magic but from time to time, newly added blueprint variable can be broken in a way that it’s always unset, ignoring what was set as default value. can be ‘fixed’ by deleting and adding again. I had this couple of times in different engine versions and I have no clue what’s the cause or how to repro
Thank you so much for your reply.
It’s good to know that I’m not the only one with this issue, however a bit sad that there isn’t a known solution for it, as it can get quite annoying.
If you end up figuring out a way to make this stop, let me know, I’d really appreciate it.
I’d like to thank everyone who tried to help.
I literally did, you need to delete the faulty variable and add it again
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.