Description
Given a C++ parent class like this:
UCLASS()
class UEP_CRASH_API AParentActor : public AActor
...
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) FString ReturnStr();
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) int ReturnInt();
and a Python subclass of it like this:
class PyChildActor(ParentActor):
def ReturnInt(self) -> int:
return 1234
def ReturnStr(self) -> str:
return 'foo'
If you place a PyChildActor in your scene and then have a different Blueprint call ReturnInt, it works. But if a Blueprint calls ReturnStr, UE4 crashes in CallPythonCallable when writing the return value into the return property:
if (ue_py_convert_pyobject(ret, return_property, frame, 0)) {
The crash is in SetPropertyValue_InContainer
.
I'm using UE4.19 + Python 3.6.7 and the latest from UnrealEnginePython's master branch.
Attached is a self-contained project that demonstrates the problem. It has the C++ base class and then 2 subclasses, one in BP and one in Python. Both subclasses implement ReturnInt and ReturnStr. When you launch the game, the level BP spawn the BP subclass and calls its ReturnInt and ReturnStr methods to verify that they work. It then spawns the Python subclass and calls its same methods. The call to ReturnInt works, the call to ReturnStr triggers the crash.