Game only worked as intended when the C++ code was debugged thru

I think this is a problem for all versions of UE. This happened before working with previous versions. I am actually working with UE5 prerelease. See this question

I had some base classes which I haven’t touched in a while because I have been just working with the child blueprint classes and I found that a menu didn’t have items it should have after I saved my game. Then, I decided to set break point in the C++ code where the inventory items (I used the Action RPG template for the inventory system of my game) are being saved and then attached the debugger in Visual Studio and saw the break points hit and my items that I got were correct and then I got the menu opened up and it displayed correctly.

Why did it work as I wanted it to when I debugged the C++ code without any changes? Is there some secret among UE C++ programmers which could be shared with me which isn’t known very well to people who spend most their time working with Blueprint?

I think I found part of my problem was with saving my game, I was loading or creating a save game when getting the save game object and when it was loading it would notify the player controller which would remove all of the items from the controller before adding the ones from the save game. I feel dumb.

The other part of the problem I think that Unreal Engine didn’t have the correct up to date C++ code hence why it only worked right when I set break points and attached the debugger and saw clearly that the break point was solid red instead of the hollowed out break point which indicates that the attached process isn’t up to date with the code.

And I forgot to set the asset manager class I am using in the project settings.

When you reparent to a more primitive base class and then reparent it again to your base class then it fixes issues.