How to get rid of ActiveClassRedirects

When I update a project to a more recent engine version, I always end up having a massive number of ActiveClassRedirects in DefaultEngine file. They look like this:

-ActiveClassRedirects=(OldClassName="SoundMode",NewClassName="SoundMix")
+ActiveClassRedirects=(ObjectName=,OldClassName="CylinderComponent",NewClassName="CapsuleComponent",OldSubobjName=,NewSubobjName=,InstanceOnly=False)
+ActiveClassRedirects=(ObjectName=,OldClassName="EternalHillCharacter",NewClassName="EternalCharacter",OldSubobjName=,NewSubobjName=,InstanceOnly=False)

There are redirects left for quite a few things: classes (both in-game and engine), blueprints, components… If you happened to rename any game class at some point, it will leave the old name as a redirect. So, after all these updates, my DefaultEngine.ini is now >100Kb. This also happens when you move or rename assets, as it seems, so these changes show up in DefaultEngine.ini, too.

Moving/renaming assets is even worse because it leaves a redirector in place of the old file, and FixupRedirects for some reason does not work for me at all (on 4.6). This is counterintuitive and sometimes messes with source control. I feel that it is the intended behavior (forum question), but why go for such a kludge if you can get away without it?

In fact, I was so concerned with renamed asset files staying in the original location as redirectors that I hacked the engine to completely disable asset redirections:

//AssetRenameManager.cpp:601
//was const bool bLeaveRedirector = RenameData.bCreateRedirector;
const bool bLeaveRedirector = false;

The editor can recognize asset references and does a good job of propagating asset renames to depending blueprints with this modified engine. While I can agree that the default behavior is kind of failsafe, it seems that the editor is lacking the “redundant redirect removal” counterpart.

Is there any way to link all game assets to their new base class location and completely erase all references to the old class name? I never use hardcoded references in the code, so renaming an asset does not affect it.

This is a bit of a purist question, because everything works as it is now, but leaving class redirects just feels like a rather ugly solution.

Hey,
Did you find a solution to this problem?

Thanks.

Did you find a solution to this problem? Thanks

Am bumping this question. there’s absolutely no solution to this it seems

Also interested in a solution if any.

Look up this buidcommand. “FixupRedirects”…

Then run it with all of your assets checked in. And source control enabled.

The assets get loaded one at a time, and the internal references get “redirected”. Once those assets are saved, the redirect can be deleted from disk, (show redirectors), or removed from the ini file manually.

on 4.14 this is the command:

\ue4Editor.exe -run=FixupRedirects -unattended -nopause -buildmachine -forcelogflush -autosubmit

Cheers,

Tested, the command you refer to is mentioned: Asset Redirectors in Unreal Engine | Unreal Engine 5.1 Documentation

Does not work. FWIW, you can see the log by not running -unattended. Also for those wanting to test I had to use the full path to my .uproject as the second arg.

I found a partial solution. Resaving the blueprints that use your asset will update the asset based on your redirects. You should be able to open up a BP. Make no changes. And the redirect will be applied. Verified by looking at the hex with Notepad++.

The problem is how do you re-save all assets? You can use the error log you get when you comment out your .ini redirects as a way to get which ones need to be updated. However, it would be nice if there was a single click / script way to re-save all blueprints.

There’s a script called “resavepackages”. But fixupredirects only saves assets that have or need active redirects. If they don’t need fixed up then nothing happens. Im afraid if you cant run 1 you’ll probably have issues with the other. They’ve been working fine for me for over 4 years.

What do you mean it doesn’t work? How does it fail?

Files still have dependencies to “OldClassName” after running. Can confirm by looking at the hex.

To my knowledge that command only fixes redirects for content.

I think FixupRedirects is about file redirects (i.e., redirects made when you move a uasset on disk), not class redirects.

You can remove the need for +ActiveClassRedirects by right-clicking the Content folder in-engine and choosing the option Re-save All Packages. You can then exit the editor and remove your +ActiveClassRedirects

Be advised this will take ages with any sizeable project, so click this only when leaving work/going to sleep etc. :smiley: