Availability:Public Title:Managing Game Code Crumbs: %ROOT%, Programming, Programming\Development Description:Adding code and generating project files. Version: 4.16 Parent:Programming/Development Order: type:overview %Globals:OSSelect% ## Adding Code to Projects ### C++ Class Wizard [INCLUDE:Programming\Development\ManagingGameCode\CppClassWizard#main] ### Development Environment [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] windows [/PARAMLITERAL] [PARAMLITERAL:active] active_button_content [/PARAMLITERAL] [PARAM:content] Code files can be created through Visual Studio and added to the game project through the **Solution Explorer** in the usual manner. You can also add code files to the appropriate folders outside of Visual Studio and rebuild the solution and project files automatically. This makes it easy to add lots of files quickly through the operating system UI, and also makes working on teams easier as the solution and project files do not need to be synced between members of the team. Each person can just sync the code files and rebuild the project files locally. [/PARAM] [/OBJECT] [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] mac [/PARAMLITERAL] [PARAMLITERAL:active] [/PARAMLITERAL] [PARAM:content] Code files can be created through Xcode and added to the game project through the **Project Navigator** in the usual manner. You can also add code files to the appropriate folders outside of Xcode and rebuild the project file automatically. This makes it easy to add lots of files quickly through the operating system UI, and also makes working on teams easier as the solution and project files do not need to be synced between members of the team. Each person can just sync the code files and rebuild the project files locally. [/PARAM] [/OBJECT] ## Opening Projects in the Development Environment [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] windows [/PARAMLITERAL] [PARAMLITERAL:active] active_button_content [/PARAMLITERAL] [PARAM:content] If your project is already open in the editor, you can easily open it in Visual Studio by selecting **Open Visual Studio** from the **File** menu. ![](open_visual_studio.png) You can also open the project in Visual Studio through Windows Explorer or Visual Studio's **File > Open > Project/Solution**. [PUBLISH:Licensee] **If your project is inside the UE4 root directory:** * Open the UE4.sln Visual Studio solution located in the UE4 root directory. **If your project is outside of the UE4 root directory:** [/PUBLISH:Licensee] * Open the [ProjectName].sln Visual Studio solution located in the root of the project's directory. [/PARAM] [/OBJECT] [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] mac [/PARAMLITERAL] [PARAMLITERAL:active] [/PARAMLITERAL] [PARAM:content] If your project is already open in the editor, you can easily open it in Xcode by selecting **Open in Xcode** from the **File** menu. ![](open_xcode.png) You can also open the project in Xcode through Finder or Xcode's **File > Open**. * Open the [ProjectName].xcodeproj Xcode project located in the root of the project's directory. [/PARAM] [/OBJECT] ## Generating Project Files [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] windows [/PARAMLITERAL] [PARAMLITERAL:active] active_button_content [/PARAMLITERAL] [PARAM:content] [REGION:warning] The project files are considered intermediate files - located in `[ProjectDirectory]\Intermediate\ProjectFiles`. This means if you delete your `Intermediate` folder, you must regenerate the project files. [/REGION] [/PARAM] [/OBJECT] [PUBLISH:Licensee] ### GenerateProjectFiles.bat **If your project is inside the UE4 root directory:** 1. Run the GenerateProjectFiles.bat batch file located in the root `UE4` directory. 1. Open the UE4.sln Visual Studio solution located in the root `UE4` directory. There are advanced options available for [](Programming/UnrealBuildSystem/ProjectFileGenerator), which can be used to generate project files for shipping (or additional platforms). [/PUBLISH:Licensee] ### .uproject files [PUBLISH:Licensee] To get the **Generate Visual Studio Files** menu item to show up in the **right-click** menu for `.uproject` files, you must first run `RegisterShellCommands.bat` in `UE4\Engine\Build\BatchFiles`. **If your project is outside of the UE4 root directory:** [/PUBLISH:Licensee] [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] windows [/PARAMLITERAL] [PARAMLITERAL:active] active_button_content [/PARAMLITERAL] [PARAM:content] 1. Navigate to the location of [ProjectName].uproject in Windows Explorer. 1. **Right-click** on the [ProjectName].uproject file and select **Generate Visual Studio Files**. ![](Generate_Visual_Studio_Files.png) 1. UnrealBuildTool updates the project files and the solution, including generating Intellisense data. ![](generate_project_files.png) 1. Open the [ProjectName].sln Visual Studio solution located in the root of the project's directory to view the game project in Visual Studio. [/PARAM] [/OBJECT] [OBJECT:ToggleButtonContent] [PARAMLITERAL:category] OS [/PARAMLITERAL] [PARAMLITERAL:id] mac [/PARAMLITERAL] [PARAMLITERAL:active] [/PARAMLITERAL] [PARAM:content] 1. Navigate to the location of [ProjectName].uproject in Finder. 1. **Right-click** on the [ProjectName].uproject file and select Generate Xcode Files. ![](Generate_Xcode_Files.png) 1. UnrealBuildTool updates the project ![](generate_project_files_xcode.png) 1. Open the [ProjectName].xcodeproj Xcode project located in the root of the project's directory to view the game project in Xcode. [/PARAM] [/OBJECT] [PUBLISH:Licensee] [REGION:note] For advanced project file generation options for projects outside the UE4 root directory, edit the RegisterShellCommands.bat batch file. The Generate Visual Studio projects (all platforms) entry shows an example of an additional menu entry, in this case with the `-AllPlatforms` flag. The [available options](Programming/UnrealBuildSystem/ProjectFileGenerator) are the same as for the main GenerateProjectFiles.bat file. [/REGION:note] [/PUBLISH:Licensee]