Broken Widget References after renaming the plugin.

The plugin we’re authoring needs to go through a name change to its official name. I’ve created a [CoreRedirects] field in Plugins/<PluginName>/Config/Base<PluginName>.ini:

[CoreRedirects]
+ClassRedirects=(OldName="/Script/<OldPluginName>Runtime",NewName="/Script/<NewPluginName>Runtime",MatchSubstring=True)
+EnumRedirects=(OldName="/Script/<OldPluginName>Runtime",NewName="/Script/<NewPluginName>Runtime",MatchSubstring=True)
+FunctionRedirects=(OldName="/Script/<OldPluginName>Runtime",NewName="/Script/<NewPluginName>Runtime",MatchSubstring=True)
+StructRedirects=(OldName="/Script/<OldPluginName>Runtime",NewName="/Script/<NewPluginName>Runtime",MatchSubstring=True)

+ClassRedirects=(OldName="/Script/<OldPluginName>",NewName="/Script/<NewPluginName>",MatchSubstring=True)
+EnumRedirects=(OldName="/Script/<OldPluginName>",NewName="/Script/<NewPluginName>",MatchSubstring=True)
+FunctionRedirects=(OldName="/Script/<OldPluginName>",NewName="/Script/<NewPluginName>",MatchSubstring=True)
+StructRedirects=(OldName="/Script/<OldPluginName>",NewName="/Script/<NewPluginName>",MatchSubstring=True)

+ClassRedirects=(OldName="/<OldPluginName>",NewName="/<NewPluginName>",MatchSubstring=True)
+EnumRedirects=(OldName="/<OldPluginName>",NewName="/<NewPluginName>",MatchSubstring=True)
+FunctionRedirects=(OldName="/<OldPluginName>",NewName="/<NewPluginName>",MatchSubstring=True)
+StructRedirects=(OldName="/<OldPluginName>",NewName="/<NewPluginName>",MatchSubstring=True)
+PackageRedirects=(OldName="/<OldPluginName>",NewName="/<NewPluginName>",MatchSubstring=True)

This is probably a bit of an overzealous carpet bombing… but we’re still running into three types of errors that stem from a failure to find blueprint / widget assets in the new location.

  1. Global functions defined in a blueprint and referenced in a different blueprint show as missing. Manually running “Refresh All Nodes” sorts this out by finding the function in the new path.

  2. Widgets that are instantiated in another widget’s hierarchy have their instances deleted. References to them as blueprint variables in the event graph show errors that the variables do not exist.

  3. Class types that are referenced in variables, Create Widget nodes or Cast nodes are missing and have reverted to type Object.

Any chance there’s a magical rearranging of the redirect strings that is off? And is there a command console command to print out what the system thinks the registered CoreRedirects are?

After some stepping through of the code in CoreRedirects.cpp, I found that BasePluginName.ini was not being processed. Moving [CoreRedirects] declarations to DefaultEngine.ini and removing the /Script lines got rid of most of the original issues. We’re still getting errors that the two Structure .uassets in the plugin are not transitioning to the new paths; for example we see the load error

Failed to load /<OldPluginName>/UI/RoomInfo.RoomInfo Referenced by BP_CavrnusGM_C

on our primary game mode object, where RoomInfo.uasset is a Structure blueprint. Variables of those types give type errors, and Break Struct blueprint nodes give errors that there’s no associated type.

If you’re interested in how this challenge was addressed during the creation of the GLS plugin demo, take a look at this article for a detailed walkthrough.