[BUG] Function with Blueprint argument error after editor restart

With a UFunction that takes a UBlueprint* as argument when the editor is restarted, the parameter becomes invalid.

Bug procedure:

1: Create and implement UFunction inside an Actor class like this:

UFUNCTION(BlueprintCallable, Category = "Test")
void TestBlueprint(UBlueprint* blueprint);

2: In the editor create a blueprint that extends from the previous class

3: Create a node calling the previous TestBlueprint function and in “Blueprint” select any other blueprint asset, it compiles without any problems and everything works perfectly:

4: Save all and restart the Unreal Editor, then reopen the blueprint:

This raises an error stating that the specified blueprint is invalid, in order to solve it you have to reassign again the value manually EVERY time the editor is restarted.

in order to solve it you have to reassign again the value manually EVERY time the editor is restarted.

You can recompile blueprint EVERY time the editor is restarted.
It won’t resolve the issue, but it’s faster then reassigning value))

@
Thanks for the comment, but recompiling doesn’t fix the issue, the blueprint is unable to compile, it displays the error “Blueprint pin is invalid”. The only way I could make it work is by reassigning.

Hey

I was able to reproduce and bug the error you described when restarting the editor (UE-16682). For now the easiest workaround seems to be reassigning the value as you mentioned.

Cheers

If anyone is interested, I have found out a workaround to this problem. I changed the function declaration to this:

void TestBlueprint(UObject* blueprint);

And then in the code I cast to UBlueprintGeneratedClass*
that way there are no blueprint reference problems