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!