重命名UE4项目
Hi!
Thanks for your patience - I wanted to check with an engineer and also run through these steps for renaming a C++ project. There may be some additional steps needed depending on the original project setup and the version you are on, so please let us know if you encounter any issues following these steps (or if you need additional steps for Mac).
This example is for creating a copy of OldName called NewName. I'd recommend doing this as a duplication process if at all possible, in case there are issues during the rename.
-
Duplicate the
OldNameproject folder. Rename the duplicate folder toNewName. -
Open the
NewNamefolder. -
Rename
OldName.uprojecttoNewName.uproject. -
Open
NewName.uprojectin a text editor, and replace all instances ofOldNamewithNewName. Save and close the file. -
If you have an
OldName.pngthumbnail, rename it toNewName.png. -
Open the
Sourcefolder. -
Rename
OldName.Target.cstoNewName.Target.cs. -
Open
NewName.Target.cs. Find all instances ofOldNamein this file withNewName. There may be some partial word matches. Save and close the file. -
Repeat step 7 and 8 for
OldNameEditor.Target.cs(renaming it toNewNameEditor.Target.cs. -
Rename this
OldNamefolder toNewNameas well. -
Open the
NewNamefolder. -
Rename
OldName.Build.cstoNewName.Build.cs. -
Open
NewName.Build.cs. Find all instances ofOldNamein this file withNewName. Save and close the file. -
Go back to the main project folder, and right-click on the
NewName.uprojectfile. Select Generate Visual Studio Project files. (If you don't have this option, runEngine/Binaries/Win64/UnrealVersionSelector-Win64-Shipping.exeonce). -
Open
NewName.sln. -
Open
OldName.cpp -
Change
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, OldName, "OldName" );toIMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, NewName, "NewName" ); -
Open the
Configfolder, and check all the configuration files forOldNamereferences to change toNewName. For example, changeGlobalDefaultGameMode=/Script/OldName.OldNameGameModetoGlobalDefaultGameMode=/Script/NewName.OldNameGameMode. -
Add the following to
DefaultEngine.ini(under an existing or new[/Script/Engine.Engine]header):+ActiveGameNameRedirects=(OldGameName="/Script/OldName", NewGameName="/Script/NewName") -
If you have any
OLDNAME_APIin your project's header files, change those instances toNEWNAME_API. -
Delete
SavedandIntermediatefolders in your project directory. -
Compile, and your project should now open without errors.
Again, please let us know if any issues come up with these renaming steps. Thanks!
浙公网安备 33010602011771号