UE4 supports binding property values with delegates. For example, this is how Brush
property is declared in UImage
:
/** Image to draw */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance)
FSlateBrush Brush;
/** A bindable delegate for the Image. */
UPROPERTY()
UWidget::FGetSlateBrush BrushDelegate;
This allows getting property value as a result of a function call or bind existing variable to this property. Bind
dropdown appears in the Editor.
If you try to declare the same inside a Slot class of a Widget, selecting such slot in the Editor makes it crash with assertion error. See stacktrace in attachment (it is from OS X).
Steps to reproduce:
- Add “Slate”, “SlateCore”, “UMG” as dependencies in Build.cs file of your project.
- Copy-paste a standard Widget with its own Slot class into your project. For example, UWidgetSwitcher. Rename it to UMyWidgetSwitcher and rename the slot to UMyWidgetSwitcherSlot, change headers as necessary for them to compile in your project.
- Create a Widget Blueprint in the Editor.
- Drop “My Widget Switcher” from “Panel” section of the Palette.
- Observe the crash.