UImage BindWidget is null

Hello.I make UI and i write this code:

UPROPERTY(meta = (BindWidget))
	class UImage* Cell;

After I created BP Widget and make Image “Cell” and pressed “Compile”,and all good.But variable Cell in my c++ class remains null.How fix this?

Hello, have you found a solution? I also encountered the same problem. It used to be effective, and it will not work after a merge

In my case, the variable binded is valid in NativeTick, NativeConstruct, but the same variable becomes nullptr in my functions.

My functions are binded to a dynamic multicast delegate, and that’s the reason. (Moving logic of the binded function to another function won’t help, adding UFUNCTION() everywhere doesn’t help too)

My guess is delegates are compile-time stuff, “BindWidget” is for runtime.

What finally worked was exposing BP function to C++ using BlueprintImplementableEvent for BindMyFunction(), and binding a custom event there. This means UI logic will go inside blueprint but that’s actually much more convenient. (Also hotreload is really going crazy this time! After commenting out every function in C++ and a fresh recompile, the blueprint function still insist my variable is nullptr; Wasted hours and creating a new BP fixed it)

Moral of the story: Use BP as much as possible for any UI, only write in .h while inheriting UUserWidget. UI is just C++ unfriendly, not worth the effort.

If someone knows how BindWidget could work with delegates in C++, please shed some light! It totally works with BP so why not C++?