The problem
By default, with Rider on UE 5.1, renaming a C++ interface function could make you lose everything you implemented in blueprint for these functions.
For instance, here is aninterface with two functions InterfaceEvent
and InterfaceFunction
:
class EMPTYMODULE_API IInterfaceName
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void InterfaceEvent();
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
bool InterfaceFunction() const;
};
And here is a blueprint implementation:
If I rename InterfaceEvent
to InterfaceEventNewName
and InterfaceFunction
to InterfaceFunctionNewName
, you loose your code, even if you enable RIder’s option to create CoreRedirect
entries:
The event is not an implementation of the interface anymore, and what I put in InterfaceFunction
was just lost
Imagine losing all your implementations over multiple blueprints…
The solution
Rider will add these two entries in [CoreRedirects]
when renaming the function:
+FunctionRedirects=(OldName="/Script/EmptyModule.IInterfaceName.InterfaceEvent",NewName="/Script/EmptyModule.IInterfaceName.InterfaceEventNewName")
+FunctionRedirects=(OldName="/Script/EmptyModule.IInterfaceName.InterfaceFunction",NewName="/Script/EmptyModule.IInterfaceName.InterfaceFunctionNewName")
Simply remove the I
prefix on the interface name:
+FunctionRedirects=(OldName="/Script/EmptyModule.InterfaceName.InterfaceEvent",NewName="/Script/EmptyModule.InterfaceName.InterfaceEventNewName")
+FunctionRedirects=(OldName="/Script/EmptyModule.InterfaceName.InterfaceFunction",NewName="/Script/EmptyModule.InterfaceName.InterfaceFunctionNewName")
And now when you open your blueprints it should work!
Once you are done refactoring, you can open all the depending blueprints and re-compile and save them to force them to use the name function names and don’t depend on core redirects anymore.
Thanks @FunGames55 for the explanations on CoreRedirects
.