I’m attempting to Cast to my created GameInstance from a blank project. The GameInstance is correctly made and is correctly set in the Project Settings.
The cast works when testing in viewport, but not in packaged builds or Standalone testing.
To me it seems the GameInstance value in Project Settings is not being set correctly from Engine Side.
It appears the issue happens after setting the GameInstance value in Project Settings to your GameInstance and then renaming the GameInstance.
The engine then creates an additional .uasset file in the directory, presumably redirectors, to redirect the one for the old filename, to the new one.
The problem appears when the redirectors are ‘fixed’ by the engine or user.
Once this happens, it removes the redundant .uasset files, which in turn clears the Project Settings: Game Instance value back to “None”, invalidating the cast for the packaged project.
I have seen in certain circumstances that this value is also not exporting properly for packaged projects. So sometimes after having renamed the GameInstance, even if the engine still hasnt removed the redirectors, the packaged build does not seem to be aware that the filename has changed, and will invalidate the cast also. But this seems to be happen less consistently.
.
.
. Anyway, if you run into this issue, you have assigned the GameInstance correctly in Project settings:
fix the redirectors or remove the extra .uasset files created by renaming the GameInstance. Restart the engine after and reset the GameInstance in Project Settings.