Using Unreal CoreRedirects When Renaming a File

When renaming a file a Blueprint using that file as a parent might lose it's class binding. Using [CoreRedirects] inside the DefaultEngine.ini file can help resolve that issue.

Unreal Engine first person Blueprint class defaults

Software Versions: Unreal Engine 5.4.4 | Rider 2024.2.7

Project Name: MyProject

When renaming a C++ file in your project's source directory you'll likely need to add a [CoreRedirects] section to your DefaultEngine.ini to references can find the correct file. If a Blueprint's parent class is based from the mentioned C++ file, it'll need the redirect to know what file to use.

Below is an example of changing the TP_FirstPersonCharacter to TP_FirstPersonCharacter_Test.

Rider renaming file in unreal engine 5 source file
Right click edit rename
Rider renaming file TP_FirstPersonCharacter.cpp to TP_FirstPersonCharacter_Test.cpp
Renaming TP_FirstPersonCharacter.cpp to TP_FirstPersonCharacter_Test.cpp

I'm using Rider and Rider helps a lot with the renaming. I'm only renaming the .cpp file, but Rider will also update the .h file and other files accordingly. Rider will prompt a notice offering to add the [CoreRedirects] section and help with the remapping.

Rider Unreal Core Redirect notice
Rider notice to add the CoreDirect section and help with remapping

Rider adds the following to the bottom of DefaultEngine.ini.

[CoreRedirects]
+ClassRedirects=(OldName="/Script/MyProject.TP_FirstPersonCharacter",NewName="/Script/MyProject.TP_FirstPersonCharacter_Test")
Rider Unreal's DefaultEngine.ini file with the added [CoreRedirects] section added
DefaultEngine.ini file with the [CoreRedirects] section

The [CoreRedirects] section should keep everything working as usual and not break your project. Rebuild the solution and things should work as expected. You might need to close and reopen the editor.

However, one unique quirk, in order to remove this code from DefaultEngine.ini you'll need to manually find the Blueprints referencing this file in your project and resave them. Simply doing "Save All" will not work.

In this example I changed TP_FirstPersonCharacter.cpp to TP_FirstPersonCharacter_Test.cpp so I have to find the Blueprints that use this file and resave it. In my example I had to resave the BP_FirstPersonCharacter and BP_PickUp_Rifle Blueprints by opening the Blueprints in the editor and clicking the save icon in the top left.

Unreal 5 editor resaving the first person character bluepring
Resaving BP_FirstPersonCharacter
Unreal 5 editor resaving the pickup rifle blueprint
Resaving BP_PickUp_Rifle

I hope this helps.

Loading...