How to Rename a UE4 or UE5 C++ Class Used by Blueprints


  • Commit all existing changes so you can cleanly roll back if required
  • Stop the editor
  • Add something like the following to <your game folder>\Config\DefaultEngine.ini, where:
    • <ProjectName> is the official project name UE4 uses in C++ for your project. E.g. the GT in GT_API that shows at the top of class declarations
    • <OldClassName> is the name of the class you’re renaming from, with no A, U etc prefix. E.g. GTPlayerState instead of AGTPlayerState
    • <NewClassName> is the name of the class you’re renaming to, again with no A, U etc prefix. E.g. GTNewPlayerState instead of AGTNewPlayerState
[/Script/Engine.Engine]
+ActiveClassRedirects=(OldClassName="/Script/<ProjectName>.<OldClassName>",NewClassName="/Script/<ProjectName>.<NewClassName>")
  • Rename just the class in C++, smallest change possible.
  • Build in Visual Studio and start the editor
  • Open the blueprint, compile and save it. File > reparent > select same new class > compile > save.
  • Remove the redirect from DefaultEngine.ini
  • Start the editor and ensure it still works
  • Close the editor
  • Rename (and move if required) the files (the .h and .cpp ones), right click on the .uproject and Generate Visual Studio project files afterwards. Also update any #include statements
  • Build in Visual Studio and start the editor
  • Ensure the editor and the blueprint open

Videogames

Hey, do you like videogames? If so please check out my game Grab n' Throw on Steam, and add it to your wishlist. One gamemode is like golf but on a 256 km^2 landscape, with huge throw power, powerups, and a moving hole. Another is like dodgeball crossed with soccer except instead of balls you throw stacks of your own teammates. And there's plenty more!

See full gameplay on Steam!


See also