Hi!
I have created a BP variable type that holds an object reference to a custom Data Asset class. These Data Assets are used as proxies for global variable data that is shared between various systems, and has has an ‘On Changed’ event:
// above class
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FHeraPropertyIntChanged, int32, newValue, int32, formerValue);`
// inside class
UPROPERTY(BlueprintAssignable, Category = "Hera|Property", Meta = (HeraProperty))
FHeraPropertyIntChanged HeraPropertyChanged;
Ideally we would like to bind to this event in the details panel as follows:
but the resultant event never triggers. However, if we bind ANOTHER event to it - after BeginPlay - then this second event DOES trigger. Here is a simple example:
When we broadcast the delegate, for the first bound function we end up in this section of code inside AActor::ProcessEvent and fail the ‘if’ statement (whereas the working event succeeds this check):
I found someone with what I believe to be the same/similar issue here, and while it has an answer I don’t know how I might go about fixing the issue: Blueprint Delegates and Event Calls - Blueprint - Epic Developer Community Forums
We would love to resolve this as it would avoid a huge amount of tedious & error-prone boilerplate code for our designers. Any help welcome, I’m quite new to UE4. Thanks!
EDIT: I’ve found that this works perfectly when playing in the standalone game, but doesn’t work in the editor. My understanding is that the original event is trying to call a function on an object whose world is invalid, whereas the events bound AFTER beginplay is calling a function on an object whose world IS valid…