Fixing up Core Redirects with the ResavePackages Command not working

I’m trying to clean up Core Redirects in my project by using the ResavePackages command. Specifically, I’m working with Property Redirects between a child and parent Blueprint in order to transfer variable instance data. I haven’t had success removing the Core Redirects while keeping the references using that command. From what I tested, the command fix up the redirector uasset files, but I’m not sure if this applies correctly to Core Redirects. I’m completely open to using something other than this command if you have another suggestion.

Steps to Reproduce

Here’s a minimal reproduction:

1. Create a blueprint A1 with a variable New Varand a blueprint A2 with a variable MyVar.

Both are instance-editable variables. A1 is the child of A2.

2. Create a map, drag A1 into the level, and set NewVar = true.

3. Close the project and add the following property redirect:

[CoreRedirects]
+PropertyRedirects=(OldName="A1_C.NewVar",NewName="A2_C.MyVar")

4. Reopen the project. Now in the level, MyVar = true and NewVar = false. The value transfer works correctly.

5. Close the project again and run the following command from the engine binaries folder:

UnrealEditor.exe PathToProject.uproject -run=ResavePackages -fixupredirects -autocheckout -projectonly -unattended6. Remove the property redirect.

7. Reopen the project. Now MyVar = false and NewVar = true (as in step 2).

Expected behavior:

I expect the result to persist as if the redirect were still applied (i.e., MyVar = true and NewVar = false).

Actual behavior:

The redirect seems to be ignored after removal, and the property value reverts.

Here the log that I have succeeded to screenshot during the execution of the command : [Image Removed]

Hello!

The Core Redirects and the Redirectors are 2 different features and the fixupredirects argument only cares for the latter.

The CRs are applied on the reference paths while resolving the dependances of an asset being loaded. They do not dirty the package so they can sometimes be tricky to get rid of. Your options are to:

  • Keep the CR in. The cost of resolving them is low and this should not cause issues
  • Run Resave packages on everything, ie without -fixupredirects,. This might a bit too much if the assets have been resaved recently.
  • Run Resave packages using -RESAVECLASS=A2_C (might need the full reference path, ie /Game/…/A2.A2_C). which should resave any package that references the A2_C class.

Regards,

Martin

Hello!

Thanks for your answer! I removed -fixupredirects from my command line, and it worked, all the files are now being scanned.

As you suggested, I’m trying to use the RESAVECLASS= argument, but I haven’t managed to get it working, whether I use the full path or just the class name. From looking at the code in UResavePackagesCommandlet, it seems like using the full path should be the correct approach, but when I try that, no packages are detected for resaving. Example of the path I used : /Game/NewFolder/BP_A2_C. I also try to use the path of A1 and A2 in the same command line, for testing but it was the same issue.

On the other hand, if I use just the class name (without the path), it simply iterates over all packages instead of targeting the packages I want.

Do you have any idea how I can solve this? It would be really helpful if I could control exactly which packages are being resaved.

After continuing to test and investigate how the path is determined in UResavePackagesCommandlet, I successfully found the correct path by sending /Game/NewFolder/BP_A2.BP_A2_C. I then tried to pass C++ classes in RESAVECLASS, but I received the same error stating that no package was detected to resave. I’m unsure if ResaveClass supports C++ classes. The path I tried using is /Script/SwitchEngineTest.MyClass. Is the path I passed in the command line wrong?

I think I found the problem. The ResaveClasses apply to the exports of the packages. You would want to so this for classes such as Anim Sequences or Textures those types are stored in packages. In your case, you will need to resave the levels that contains instances of the BPs so their properties are updated. You can use the -Map= or -MAPSONLY arguments to only resave levels. Sorry for the confusion.

Thank you for your help! The arguments for the levels will definitely be useful. Have a great day!