So I’m switching over to the 4.3 source solution, which so far works fine. I now want to have my game / game editor project included in my solution, and using these binaries built from the source code.
What’s the ‘official’ structure for having a game included in this solution, and how do I take my totally-independent project and slot it in, including telling it to rely on source binaries instead of those straight from the launcher?
Setup:
SomeFolder/UnrealEngine/Engine
SomeFolder/UnrealEngine/Templates
SomeFolder/UnrealEngine/GAME_FOLDER ← Should I structure it this way?
When you built the Engine from source code, make sure you go into the Engine/Binaries/Win64 folder and run the UnrealVersionSelector-Win64-Shipping.exe executable. This will make sure your source code version of the Engine is successfully registered with Windows.
Once you have done that, open your project folder and right-click on the .uproject file. Select the Switch Unreal Engine version option. In the window that appears, select the location of the source code version of the Engine that you created and click OK. This will associate your project with the new source code version of the Engine. If you have a Blueprint-only project, you can go ahead and open the project with the source code version of the Engine. If you have a code project, or have added code to a Blueprint project, you will need to right-click the .uproject file again and select Generate Visual Studio project files. Open the solution in Visual Studio and build, and you will be all set.
You may run into build errors/warnings in Visual Studio or Blueprints when you move a project to a different version of the Engine, though this is most common when upgrading to a new version of the Engine. You will need to resolve these before moving on. The number of errors/warnings that you receive will usually depend on the complexity of your project, and as the Engine matures with future versions these errors/warnings will become less frequent.
Your game project will not be included in the Engine’s solution. However, once you have switched the game project to use your source code version of the Editor, when you open the solution for the game project, you will notice that it now includes the UE4 source code as well. When you open the game project itself by double-clicking on the .uproject file, it will use the binaries that were created when you built the Engine using the source code.
If you were to switch your project back to using the binary version of the Engine from the Launcher, the source code will no longer be available in the game project’s solution, and opening the game project will now use the Engine installed by the Launcher.
One thing you may want to keep in mind once you start working in game projects using the Engine built from source is that since it includes the source code in the solution, building or debugging the solution means you will be building the Engine in addition to your game project. If you do not already do so, it may be a good idea to build or debug by right-clicking on your game project in Visual Studio and selecting the appropriate option from the context menu. Build times have already been reduced significantly since the Engine was launched, but you will still save a little time by doing this.
Is it possible to conduct the steps you have given without a launcher install? We’re using UE4 over a large network, and thus haven’t downloaded the engine from scratch on every single PC (can you imagine!). The binaries themselves are distributed to each computer, however.
It should not be necessary to have the Launcher installed in order to run the Editor that you have built from source code. The first time you run the Editor, it may begin to install the Launcher, but you can stop that process and the Editor should continue to run fine. I cannot confirm that however, since all of our computers here have the Launcher installed. I should probably look into the possibility of having at least one computer set up to use only versions of the Engine that were built from source code.
It is also theoretically possible to copy the Unreal Engine folder after the Engine has been built and place that copy on another computer. This is also something I have not actually tried outside of using source control, so I cannot confirm that. It might be worthwhile to investigate setting up a source control repository for both the Engine and your game project.
The part I was worried about was that the various options available upon right-clicking the uproject file should only be available when the launcher is installed, and when it has a fully-downloaded version of an engine. Will using the UnrealVersionSelector-Win64-Shipping.exe file add these options to Windows Explorer?
You are correct. Running UnrealVersionSelector-Win64-Shipping.exe will allow the three UE4-specific options to become available in the right-click context menu for .uproject files. If you do not see those options after running the executable, please let us know.
I’ve tried to follow your steps on a fresh PC that doesn’t have the launcher installed.
Should I build the engine first, then run UnrealVersionSelector-Win64-Shipping.exe? If I do it before the engine itself is built, the context menu is not updated and thus the .uproject file can’t be switched to the source version, and the .sln and .vcxproj files for the game solution aren’t updated either.
I have tried this suggestion after building the engine, and I still have no additional options in my right-click context menu. Is there a step I am missing?
*- Put source and dependencies on a new PC
GenerateProjectFiles.bat inside the UnrealEngine folder
Open UE4.sln and build the UE4 project
Run UnrealVersionSelect-Win64-Shipping.exe
Use context menu options in Windows Explorer to set engine version of game uproject file to use the source-built version.
Use context menu option again to generate project files and the sln for the game project.*
Just checking back in - as my other reply says, running UnrealVersionSelector-Win64-Shipping.exe does not bring up the context menu in Windows, even when run after the engine is built.
Everything that you have been doing should be working. There are a few things that would be good check.
When you run UnrealVersionSelector-Win64-Shipping.exe, do you get a “Registration Successful” message when it completes?
Do you have admin rights when you run the executable? Have you tried running it as administrator?
Does Windows have a file association already in place for .uproject files? Right click on your .uproject file and select Properties. Does it show “Opens with: Unreal Engine”?
I do get that message, yes, and I have run it as administrator.
Negative - there is no windows file association, and it is not displayed as an option to select. Browsing to the Editor .exe as the program to ‘Open with…’ does not change the open settings - the file association is never changed.
I did previously use dragged-in copies of 4.2 and 4.3 binaries (without the launcher), in which case I did have to set the file association manually. After removing those files, windows can’t seem to associate with anything that has the same name (i.e. the editor exe). It just won’t let it be ‘set’ to that.
EDIT: To clarify, if you set the file association to one location/version of the exe, then try to change it to another, it won’t actually change (it thinks they’re the same thing, I guess?).
In the Properties window for your .uproject file, if you click the Change button next to the Opens with property, does it show any options there at all? What I would expect is that you would see two Unreal Engine options, one with a black icon and one with a blue icon. Do you not see either of those options?
Sorry for the lengthy delay in getting back to you. We are still unsure why Windows is not properly setting the .uproject association. If you could please download this file and save it to an empty folder on the desktop of one of the computers you are trying to put the Engine on. Remove the .txt extension and run the file. It will create a new info.txt file containing information about the computer’s registry keys that are involved in the process of associating the .uproject files with Windows. Please upload that new file so we can take a look at it.