Private variables losing values/resetting to defaults during runtime

I have a strange issue that I can’t repro in a new project, so it is something specific to one project, but I was hoping someone might recognize a pattern and have some insight into my problem. I noticed some of my variables are being reset to default when trying to use them. The setup to repro this in my project is this.

Create enum with 2 members. create 2 variables of enum type, one private (PreviousState) and one public (CurrentState).

setup a function as illustrated.

This is a simple trap to detect variable change.

What happens is when i select Option2, the breakpoint pictured gets hit. When I switch back to Option1 it does not get hit, the PreviousState (private) variable gets reset to Option1 as soon as I change CurrentState to Option1 and the branch does not evaluate as true because they are the same. This only happens when PreviousState is private, if i mark this variable as public, everything works normally.

I have had another instance of this problem with an object variable, but the setup was difficult to reproduce. I’m hoping someone with some engine knowledge can shine some light on what might be going on.

this repro is BP only, but I do have c++ code and it does the same thing with a c++ enum.

Any help is appreciated, thanks!

Update: I spent the afternoon systematically debugging this problem, I’m not sure the exact cause, but when I removed the /Saved/Config folder, everything started working normally. I don’t have time to debug it down to the specific file, but it is solved.

I wasn’t aware there was anything in the Saved folder that could affect a project in that way, I have only been removing Intermediate/Binaries directories when I want to clean.

@JoeWintergreen probably knows whats up.

This is probably this bug again:

This unfortunately is not the same issue I don’t believe, correct me if I am wrong. I ran into this thread a few times while debugging my issue. These variables are reset during design-time, usually when editor is closed and reopened. Mine is resetting during run-time.

So my issue with the enums seems to have been resolved, but I found another instance of a reference variable being reset to NONE at run-time again today.

it is literally, 1st frame Set VariableReference (has legit value), next frame Get VariableReference (NONE). If I make the value public, it is working fine. I might have to dig into the Saved/Config stuff a little more after all so I can get to the root of this problem. It has been a very frustrating bug.

scratch that, my enum issue has returned as well, I’ll report back when I narrow it down again, just removing the Saved folder didn’t seem to work this time.