Skip to content

Commit 5ed5719

Browse files
committed
fix the problem which multiscrpit_delegate causes engine crash.
1 parent d1ae7ab commit 5ed5719

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4460,16 +4460,16 @@ PyObject* ue_bind_pyevent(ue_PyUObject* u_obj, FString event_name, PyObject* py_
44604460
}
44614461

44624462
#if ENGINE_MINOR_VERSION >= 25
4463-
if (auto casted_prop = CastField<FMulticastDelegateProperty>(f_property))
4463+
if (auto casted_prop = Cast<UMulticastDelegateProperty>(f_property))
44644464
#else
44654465
if (auto casted_prop = Cast<UMulticastDelegateProperty>(u_property))
44664466
#endif
44674467
{
4468-
#if ENGINE_MINOR_VERSION < 23
4469-
FMulticastScriptDelegate multiscript_delegate = casted_prop->GetPropertyValue_InContainer(u_obj->ue_object);
4470-
#else
4471-
FMulticastScriptDelegate multiscript_delegate = *casted_prop->GetMulticastDelegate(u_obj->ue_object);
4472-
#endif
4468+
//#if ENGINE_MINOR_VERSION < 23
4469+
// FMulticastScriptDelegate multiscript_delegate = casted_prop->GetPropertyValue_InContainer(u_obj->ue_object);
4470+
//#else
4471+
// FMulticastScriptDelegate multiscript_delegate = *casted_prop->GetMulticastDelegate(u_obj->ue_object);
4472+
//#endif
44734473

44744474
FScriptDelegate script_delegate;
44754475
#if ENGINE_MINOR_VERSION >= 25
@@ -4482,14 +4482,15 @@ PyObject* ue_bind_pyevent(ue_PyUObject* u_obj, FString event_name, PyObject* py_
44824482
script_delegate.BindUFunction(py_delegate, FName("PyFakeCallable"));
44834483

44844484
// add the new delegate
4485-
multiscript_delegate.Add(script_delegate);
4485+
//multiscript_delegate.Add(script_delegate);
4486+
casted_prop->AddDelegate(script_delegate, u_obj->ue_object);
44864487

44874488
// re-assign multicast delegate
4488-
#if ENGINE_MINOR_VERSION < 23
4489-
casted_prop->SetPropertyValue_InContainer(u_obj->ue_object, multiscript_delegate);
4490-
#else
4491-
casted_prop->SetMulticastDelegate(u_obj->ue_object, multiscript_delegate);
4492-
#endif
4489+
//#if ENGINE_MINOR_VERSION < 23
4490+
// casted_prop->SetPropertyValue_InContainer(u_obj->ue_object, multiscript_delegate);
4491+
//#else
4492+
// casted_prop->SetMulticastDelegate(u_obj->ue_object, multiscript_delegate);
4493+
//#endif
44934494
}
44944495
#if ENGINE_MINOR_VERSION >= 25
44954496
else if (auto casted_prop_delegate = CastField<FDelegateProperty>(f_property))

0 commit comments

Comments
 (0)