Skip to content

Commit 7c7402d

Browse files
committed
Allow classes to be assigned to Properties that are defined as taking a UObject
1 parent dcfaf02 commit 7c7402d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,6 +2437,14 @@ bool ue_py_convert_pyobject(PyObject *py_obj, UProperty *prop, uint8 *buffer, in
24372437
casted_prop_weak_object->SetPropertyValue_InContainer(buffer, FWeakObjectPtr(ue_obj->ue_object), index);
24382438
return true;
24392439
}
2440+
else if (auto casted_prop = Cast<UObjectPropertyBase>(prop))
2441+
{
2442+
// ensure the object type is correct, otherwise crash could happen (soon or later)
2443+
if (!ue_obj->ue_object->IsA(casted_prop->PropertyClass))
2444+
return false;
2445+
casted_prop->SetObjectPropertyValue_InContainer(buffer, ue_obj->ue_object, index);
2446+
return true;
2447+
}
24402448

24412449
return false;
24422450
}

0 commit comments

Comments
 (0)