Permanently apply Core Redirects for UAssets to c++?

Is it possible to permanently apply a Core Redirect so I can replace Blueprint asset references with c++ classes?

In general, when you instantiate objects, it’s generally better to instantiate a blueprint than to instantiate a C++ class directly. The reason for this is that there’s no runtime cost to a blueprint that doesn’t use any wiring nodes – it’s just data, and allowing artists/designers to tweak what goes on, without changing the code, is generally a good thing.

So, one way to move in the direction you want, while retaining the blueprint configurability benefit, is to re-parent the blueprints that you currently have, to have your C++ class as parent, and then remove any events/functions/overrides, keeping them as data-only blueprints.

This is not exactly what you asked for, but I think it will accomplish approximately the same goal, while retaining artist control.

Recompile blueprints and resave them.

1 Like

I see what you mean but reparenting is not an option for enumerators and structs which I am porting to c++. This is also a 1600 file project.

That is what I hoped would work but it doesn’t. After removing the Core redirect from the ini file all blueprints referencing the structs, enums and classes will throw errors until I add the redirects back to the ini.

Redirects are applied on loading assets. So you need to resave every asset that depends on the redirector, which can include seemingly unrelated blueprints. You can use the ResavePackages commandlet to do this, but as far as I know there is still no way to resave only those assets that actually used core redirects… leading to rather large changelists when doing this.

What Neyl_S said solved my problem

  • Make sure you created the redirects
  • Tested if they work
  • Then while the redirects are working compile blueprints and save all assets referencing redirected stuff
  • Then you can remove the redirects from the ini file

Thanks for testing. I’ve been moving tons of BP classes to c++ manually because I was not able to save redirects permanently while I tested it. Possibly the reason it didn’t work for me is that I did not recompile / resave all blueprint dependency UAssets or had a compile error on a BP while I was testing the redirects, which is likely.