Unreal Engine Could Not Find Code File when attempting to navigate to the c++ source file. To solve this error you DO NOT need to build from source or move your Unreal Engine Installation to another drive. So you get to keep it on your C:/ SSD Drive for fast access.
Where It happens
- In Blueprints “Go To Definition” Function
- Inside Widget Reflector When Attempting to navigate to C++ Source (on click)
Why Does It Happen
There are a few number of reasons why Unreal Engine could not find code file error would happen.
Among those is that the binary version of Unreal Engine seems to have been built on a D:/ Drive or whatever Drive letter it references in the error message. Basically a hard link was set by the developers and thus unreal engine will always start searching for files by following the D:/build/… path. If the path doesn’t exist, it assumes the files do not exist and throws that error. A mistake since the files actually DO Exist on your computer, just on a different drive or path.
How To Fix It
Although we can not “fix it” , we can work around the problem and get unreal engine to play nice. Here is how:
The D:/ drive
First we need a D:/ labelled drive. If you have 2 Hard Drives on your computer, you most likely already have an SSD or HDD assigned the drive letter D. You can skip this part.
But in case you don’t, here is what to do:
You have to partition your main “C:/” Harddrive and assign the newly created Drive with the letter “D”. This doesn’t have to be a large partition. Even 100MB is okay.
See the following for references on how to do so:
https://www.youtube.com/watch?v=1V2vnfsAe0M
https://www.youtube.com/results?search_query=How+to+Partition+C+Drive+in+Windows+10
Redirecting Unreal Engine
To Redirect Unreal Engine from the D Drive and point it to the C Drive where our code files live, we need to use symbolic links. Symbolic links are a feature of windows.
I recommend this software for creating symbolic links:
https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html
https://winaero.com/manage-symbolic-links-hard-links-and-junctions-easily-with-link-shell-extension/
For Unreal Engine 4: This is the path you need to build:
D:\build\++ue4+Licensee\sync\{Engine Folder Symolic Link Here}
For Unreal Engine 5:
D:\build\++UE5\Sync\Engine\{Engine Folder Symolic Link Here}
Install Editor Symbols
For the last and final part, we need to install “Editor Symbols For Debugging”
Conclusion
That’s It. One important thing to note is that this works only if you have One Version for Unreal Engine installed. So you have to choose the main Version you use and apply this fix to it. Luckily, The paths for UE5 and UE4 versions don’t conflict. So you can have one version of UE4 and one Version of UE5 at the same time using this method.