UE 5.1.1 does not load c++ scripts until doing a livecoding rebuild

I have an empty project with just my own gamemode class and a pawn script which holds a camera reference. These work fine, but when I close / reopen my project, the Pawn script will not be in the Content browser and my Level says “contains invalid actor files” since the pawn script cant be found. Rebuilding in VS (ctrl + shift + F11) brings the script back. this happens every time I reopen. Any ideas how to make sure unreal loads the scripts as it opens?

you have to rebuild from visual studio

2 ways:

open visual studio and then press CTRL+SHIFT+B and let it compile, the time it takes depends on your computer, plus if you have Unreal engine installed on your SSD it takes a lot less to compile.

another way is to just close unreal engine completely and run the build from Visual studio by pressing CTRL+F5.

Make sure you have live coding disable when you are compiling with the Visual studio.

Live Coding is not the best IDE out there, I wouldn’t get use to it too much, Personally I always have it disabled.

CTRL+SHIFT+B is the way to go if you have Unreal Engine downloaded from the epic launcher, if you have unreal engine from source code, then CTRL+SHIFT+B would take a lot of time, so in this case the best option is to close Unreal engine everytime you are making C++ changesand just run the build from Visual studio (CTRL+F5).

Hope this helps