- CreateWidget
- Initialize
- NativeOnInitialized
- AddToScreen
- NativePreConstruct
- NativeConstruct
- NativeTick
- NativeDestruct(销毁的时候调用)
-
UPROPERTY(Meta = (BindWidget))
是在Initialize
中完成绑定的(在NativeOnInitialized
执行前就完成了),因此对事件的绑定放在NativeOnInitialized
中。如果不想通过宏绑定,那么也可以手动绑定
bool UUHealthBar::Initialize() { const bool Result = Super::Initialize(); PlayerName = Cast<UTextBlock>(GetWidgetFromName(TEXT("PlayerName"))); if (!PlayerName) { return false; } return Result; }