Rename Your Project (including Code)

Renaming a project seems like it should be a simple thing, but it's fraught with pitfalls. If you do it wrong, you can accidentally nuke your project. Follow the steps below to ensure that there's no data loss when you rename your Unreal Engine 4 project.

Backup: As always, before making a big change like this, it's a good idea to back up your project. And of course, make sure that your project is not open in the Editor while renaming.

  1. Duplicate the OldName project folder. Rename the duplicate folder to NewName.
  2. Open the NewName folder.
  3. Rename OldName.uproject to NewName.uproject.
  4. Open NewName.uproject in a text editor, and replace all instances of OldName with NewName. Save and close the file.
  5. If you have an OldName.png thumbnail, rename it to NewName.png.
  6. Open the Source folder.
  7. Rename OldName.Target.cs to NewName.Target.cs.
  8. Open NewName.Target.cs. Find all instances of OldName in this file and replace with NewName. There may be some partial word matches. Save and close the file.
  9. Repeat steps 7 and 8 for OldNameEditor.Target.cs.
  10. Rename the Source subfolder from OldName to NewName as well.
  11. Open the NewName folder.
  12. Rename OldName.Build.cs to NewName.Build.cs.
  13. Open NewName.Build.cs. Find all instances of OldName in this file and replace with NewName. Save and close the file.
  14. Go back to the main project folder, and right-click on the NewName.uproject file. Select Generate Visual Studio Project files.
  15. Open NewName.sln.
  16. Open OldName.cpp.
  17. Change IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, OldName, "OldName" ); to IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, NewName, "NewName" );
  18. Open the Config folder, and check all the configuration files for OldName references to change to NewName. For example, change GlobalDefaultGameMode=/Script/OldName.OldNameGameMode to GlobalDefaultGameMode=/Script/NewName.OldNameGameMode.
  19. Add the following to DefaultEngine.ini under the [/Script/Engine.Engine] header: +ActiveGameNameRedirects=(OldGameName="/Script/OldName", NewGameName="/Script/NewName").
  20. If you have any OLDNAME_API references in your project's header files, change those instances to NEWNAME_API.
  21. Delete Saved and Intermediate folders in your project directory.
  22. Compile, and your project should now open without errors.


Copyright 2020 Mowgl33.