How to rename your project in UnrealEngine

Environment
UnrealEngine branch: 5.0
Visual Studio 2022 version: 17.0.4
Windows 11 Pro build: 22000.493

Overview

Sometimes, you might need to rename your project in some reasons.

  • Just you may be bored with that name.
  • To unify the name same with your team name.
  • Due to change on design of game…etc.

Unfortunately, in those situations, UnrealEngine does not provide any feature to rename your project.
So, in this post, we gonna find out how to rename your project manually.

Prerequisites

Suppose we have a project created from template Third Person with options above.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[ProjectRoot]/Source/SomeProjectA/SomeProjectACharacter.h

UCLASS(config=Game)
class ASomeProjectACharacter : public ACharacter
{
GENERATED_BODY()

/** Camera boom positioning the camera behind the character */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
class USpringArmComponent* CameraBoom;

...

public:
/** Returns CameraBoom subobject **/
FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
/** Returns FollowCamera subobject **/
FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }

UFUCTION(BlueprintPure)
const FString GetSomeString() const { return TEXT("SomeString"); }
};

After the project created, make a simple function GetSomeString() in the character class, which returns some string. We will try to migrate the function for example later in this post. Now, build editor with the combo Development Editor + Win64 and run it.

You can find a character blueprint created from template in the Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter. Furthermore, the blueprint has a parent class as the cpp class SomeProjectACharacter. It means that the blueprint can use the function we have just made.

I think it would be proper to print that string when character spawned. Make some blueprint nodes for printing that string. Now, compile and save it.

Check it works out. You should be able to see that string SomeString through the screen. Great.

1
2
3
4
5
6
7
8
.../SomeProjectA> git log
commit 32688a379adc5fad30ae7ba9765816684c62d05e (HEAD -> master)
Author: MinCheon Bae <baemincheon@gmail.com>

Initial commit
.../SomeProjectA> git status
On branch master
nothing to commit, working tree clean

I setup the project directory as git repository to clarify what is changed. You do not have to follow this, it is optional. But, you should prepare a gitignore fits in UnrealEngine if you want to follow this. (For example, https://github.com/github/gitignore/blob/main/UnrealEngine.gitignore)

We are all prepared, and let us change the name of project from SomeProjectA into OtherProjectB.

Step #1; Clean-up

First of all, we should remove some files. Some files and folders are generated by other files, so we do not have to care about that files would be generated later. Thus, we would better remove those files or folders listed below:

  • .vs/
  • Binaries/
  • DerivedDataCache/
  • Intermediate/
  • Saved/
  • [ProjectName].sln

You can check if the files or folders are generated. Remove them and generate VisualStudio project files. Then, files and folders related to VisualStudio would be generated. And you can build your project from VisualStudio project. After all, you will see the files and folders listed above are restored.

Plus, that is why gitignore for UnrealEngine contains those files or folders. We do not need them to be version-controlled.

Step #2; Change contents of files

Now it is time to rename the project. There are some files usually contain the name of project in its contents. Therefore, we should change that part of contents. In this goal, we will manipulate the files like…

  • all of files in Config/
    • .ini files such as DefaultEngine.ini
  • all of files in Source/
  • [ProjectName].uproject

Maybe there some files contain the name of project in the folder Content/. Such as an absolute path of media file, and a blueprint class inherites a cpp class whose name contains the name of project. However, basically the files in Content/ are binary type. So, manipulating its contents as text might not ensure a result we expect. In worst case, the manipulation could break some references between blueprints. That is why we handle only the files of text type in this step.

By the way, I recommend you to use notepad++ when manipulating multiple text files, and I will use that in this post. It is open source and provides powerful features. The tool supports Windows and you can install it for ease. You do not have to install it, but I will show an example based on the tool.

Open the notepad++ and drag your project folder from file explorer into notepad++. Now notepad++ would show the folder as list view at the left sidebar.

Right click on Config/ and select Find in Files.... Then, a dialog for search would appear.

Click the tab Find in Files and type SomeProjectA and OtherProjectB respectively at Find what and Replace with. After that, click Replace in Files.

Repeat the steps on Source/ folder.

Open the .uproject file and Replace in similar manner.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.../SomeProjectA> git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Config/DefaultEngine.ini
modified: SomeProjectA.uproject
modified: Source/SomeProjectA.Target.cs
modified: Source/SomeProjectA/SomeProjectA.Build.cs
modified: Source/SomeProjectA/SomeProjectA.cpp
modified: Source/SomeProjectA/SomeProjectACharacter.cpp
modified: Source/SomeProjectA/SomeProjectACharacter.h
modified: Source/SomeProjectA/SomeProjectAGameMode.cpp
modified: Source/SomeProjectA/SomeProjectAGameMode.h
modified: Source/SomeProjectAEditor.Target.cs

We can see some files changed. Now the contents of file get ready.

Step #3; Change name of files

We have changed the contents of files. Next, let us change the name of files. This also works whole project without Content/ folder with the same reason I mentioned.

Open a powershell prompt and type the command like below:

1
%ProjectRoot% > Get-ChildItem -Recurse -Path Config/* | Rename-Item -NewName { $_.Name.replace("SomeProjectA","OtherProjectB") }

This will change the name of all files in Config/ folder.

1
%ProjectRoot% > Get-ChildItem -Recurse -Path Source/* | Rename-Item -NewName { $_.Name.replace("SomeProjectA","OtherProjectB") }

Apply this on Source/ folder, too. After that, change the name of .uproject file and [ProjectRoot] folder manually.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.../OtherProjectB> git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Config/DefaultEngine.ini
deleted: SomeProjectA.uproject
deleted: Source/SomeProjectA.Target.cs
deleted: Source/SomeProjectA/SomeProjectA.Build.cs
deleted: Source/SomeProjectA/SomeProjectA.cpp
deleted: Source/SomeProjectA/SomeProjectA.h
deleted: Source/SomeProjectA/SomeProjectACharacter.cpp
deleted: Source/SomeProjectA/SomeProjectACharacter.h
deleted: Source/SomeProjectA/SomeProjectAGameMode.cpp
deleted: Source/SomeProjectA/SomeProjectAGameMode.h
deleted: Source/SomeProjectAEditor.Target.cs

Untracked files:
(use "git add <file>..." to include in what will be committed)
OtherProjectB.uproject
Source/OtherProjectB.Target.cs
Source/OtherProjectB/
Source/OtherProjectBEditor.Target.cs

Check the result with git status again.

Step #4; Redirect blueprints

Generating VisualStudio project files okay. Building editor on VisualStudio project okay. But, there is one last task to do.

We skipped blueprint files in previous steps. But, some blueprint assets could try to use old cpp classes or codes. Therefore, you will see the dialog while opening the editor. The CDO has been broken.

Some of blueprint classes lost their parent cpp class or get broken. Especially, the blueprint class ThirdPersonCharacter was disconnected with its parent, old cpp class SomeProjectACharacter. We need to fix it.

1
2
3
4
5
6
7
// DefaultEngine.ini

[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="SomeProjectA",NewGameName="/Script/OtherProjectB")
+ActiveGameNameRedirects=(OldGameName="/Script/SomeProjectA",NewGameName="/Script/OtherProjectB")
+ActiveClassRedirects=(OldClassName="SomeProjectAGameMode",NewClassName="OtherProjectBGameMode")
+ActiveClassRedirects=(OldClassName="SomeProjectACharacter",NewClassName="OtherProjectBCharacter")

Fortunately, UnrealEngine provides redirecting blueprint classes. You can set the redirection settings in DefaultEngine.ini. I have set the settings like above, and engine will redirect SomeProjectA things into OtherProjectB things. You should create more settings if you need. Because the example settings are from template and your project may have more classes whose CDO broken.

After setting up the redirection, remove Binaries/ + DerivedDataCache/ + Saved/ folders. And repeat build the editor.

Finally we meet again ! The string SomeString was the text we prepared. We have done renaming a project and restoring whole project.