There may come times when classes, enumerators, structures, and other such files need to be renamed while developing an Unreal Engine project. Doing so without proper consideration can cause catastrophic data loss due to the engine not recognizing those renamed assets. Thankfully, Epic has provided an easy solution for that --- Core Redirectors.
Simply put, Core Redirectors is a method to tell Unreal Engine that X is now Y.
As an important note, Core Redirectors is the manual method for setting redirectors. When renaming and moving files within the content browser, redirectors will be automatically generated. These redirectors can be easily fixed by right-clicking all of the folders in your content directory and clicking Fix Redirectors.
; Project Config
*/{ProjectName}/Config/DefaultEngine.ini
; Project Plugin Config
*/{ProjectName}/Plugins/{PluginName}/Config/Default{PluginName}.ini
; Engine Plugin Config
*/Epic Games/UEVersion/Engine/Plugins/PluginPath/{PluginName}/Config/{PluginName}.iniThere are multiple different redirector types, and each type is approached differently.
The redirectors must be placed within the [CoreRedirects] section of the .ini files.
+PackageRedirects=(OldName="/OldName/", NewName="/NewName/")
; For redirecting within the same module
+ClassRedirects=(OldName="/Script/ModuleName.OldClass",NewName="/Script/ModuleName.NewClass")
; For redirecting between modules
+ClassRedirects=(OldName="/Script/ModuleA.OldClass",NewName="/Script/MobuleB.NewClass")
; For redirecting from a Blueprint Class to a Native C++ Class
+EnumRedirects=(OldName="BlueprintClass",NewName="/Script/Module.NativeClass",OverrideClassName="/Script/CoreUObject.Class"); For redirecting within the same module
+StructRedirects=(OldName="/Script/ModuleName.OldStruct",NewName="/Script/ModuleName.NewStruct")
; For redirecting between modules
+StructRedirects=(OldName="/Script/ModuleA.OldStruct",NewName="/Script/ModuleB.NewStruct"); For redirecting within the same module
+EnumRedirects=(OldName="/Script/ModuleName.EOldStruct",NewName="/Script/ModuleName.ENewStruct")
; For redirecting between modules
+EnumRedirects=(OldName="/Script/ModuleA.EOldStruct",NewName="/Script/ModuleB.ENewStruct")Note: Unlike the other redirectors, enumerators require the E prefix.
Here is an example utilizing the different redirector types.
[CoreRedirects]
; Plugin Redirector
+PackageRedirects=(OldName="/OldGenericPlugin/", NewName="/NewGenericPlugin/", MatchSubstring=true)
; Class Redirectors
+ClassRedirects=(OldName="/Script/OldGenericPlugin.GenericActor",NewName="/Script/NewGenericPlugin.GenericActor")
+ClassRedirects=(OldName="/Script/OldGenericPlugin.OldGenericWidget",NewName="/Script/NewGenericPlugin.NewGenericWidget")
; Struct Redirectors
+StructRedirects=(OldName="/Script/OldGenericPlugin.GenericStruct",NewName="/Script/NewGenericPlugin.GenericStruct")
; Enum Redirectors
+EnumRedirects=(OldName="/Script/OldGenericPlugin.EGenericStruct",NewName="/Script/NewGenericPlugin.EGenericStruct")Here are some useful tips when dealing with Core Redirectors.
Redirectors can be safely removed once the affected assets, and the assets that use them, have been re-compiled and re-saved.
Don't worry! This just means that you are missing some redirectors. Carefully read through your Output Log for the cause.
Also, make sure you do not attempt to re-compile or re-save the assets that produce the issues. This can cause the redirector to not work as intended. Especially for variables. If this does occur, you will have to manually go in and replace those variables.
Check out the following resources to learn more about the subject.