Using Redirects with C++ Structs?

The error is using the old syntax. As of UE 5.0, you can add a struct redirect like so:

+StructRedirects=(OldName="/Script/MyGame.OldStructName", NewName="/Script/MyGame.NewStructName")

A few gotchas:

  1. The redirect system omits the ‘F’ in front of a struct name, even though Epic’s style guide requires it.
    So if your struct name is FOldStructName in c++, you need to type OldStructName in the StructRedirects (without the ‘F’). The above example would be correct when renaming FOldStructName to FNewStructName.

  2. If you’ve redirected the same struct more than once, you’ll need to update the old redirects as well.

So if redirect 1 looked like:

+StructRedirects=(OldName="/Script/MyGame.OldStructName", NewName="/Script/MyGame.NewStructName")

If you now want to call it NewStructName2, you’ll have to have this now:

+StructRedirects=(OldName="/Script/MyGame.OldStructName", NewName="/Script/MyGame.NewStructName2")
+StructRedirects=(OldName="/Script/MyGame.NewStructName", NewName="/Script/MyGame.NewStructName2")

So both of the previous names correctly redirect to the latest struct name. If you forget to update the old redirect, it will not resolve correctly.

Epic’s documentation covers this use-case: Core Redirects | Unreal Engine Documentation

1 Like