else if conditional passing even though the conditions haven't been met?

Hey there! I have a c++/unreal question. I’m using VS2022 here and the code inside of this else if gets ran even when the condition isn’t met. Has anyone else had similar issues? The breakpoint above the current one doesn’t ever get hit and it somehow skips to the return true portion. I’ve tried deleting .vs folder and my sln etc and regenerating the project files. Also tried clean/rebuild because it seems like an indexing issue or something but no dice. How is it able to reach this point?


image

It’s probably just a debugger thing

If you disable optimization around your function you should be able to see the actual path of the code and the relevant values

My guess is that CurrentState has been optimized away so it shows as None

And I’m guessing that the compile verbosity of LogPW stops it from being compiled, which is why the breakpoint at line 266 isn’t hit

So I actually found there was a different clean/rebuild button then the one I was pressing. After clicking those I started getting a ton of errors with the engine and now I can no longer compile/play. Seems like they are saying something about version mismatches between SDKs but I’m using the recommended version of VS2022 with UE5 so not really sure how this would get past any testing at Epic?

What is your default project (what is in bold in the solution editor). Is it your game or UE5?
If it’s Unreal the right click your game and make it the default project.
Right click your project an choose “Set as Startup Project”.
Then try the rebuild option.

You are probably trying to compile the engine by accident and I’m guessing your engine version in the binary version and not built from source, so it will fail to compile.

It was my game but I’m not sure if the startup project changed. Originally, I had been building my game out of VS2022 for a few weeks but hadn’t really been changing code yet. Then I ran into the else if issue where it seemed like my changes weren’t lining up with the breakpoints. I uninstalled/reinstalled VS and got these errors. When building my project it would say something like “1 succeeded, 9 failed” and give the errors listed in the SS above. I ended up reformatting my C drive and reinstalling everything.

Now my project is okay and builds with no errors! But crashes on launch during shader compilation and points to UnrealEditor-Core or UnrealEditor-ShaderPreprocesser with access violation reading location.

This is the same crash I get when trying to run Lyra so I’m assuming this is just some weird issue with my PC and UE5 + dx12.