1 创建UI/Widget/AuraUserwidget
2 创建UI/WidgetController/AuraWidgetController UObject类
3在AuraUserWidget.h中
public:
UFUNCTION(Blueprintcallable)
void SetWidgetController(UObject* InWidgetController);
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UObject> WodgetController;
protected:
UFUNCTION(BlueprintImplementableEvent)
void WidgetControllerSet();
4在AuraUserWidget.cpp中
SetWidgetController(UObject* InWidgetController)
{
WidgetController = InWidgetController;
WidgetControllerSet();
}
5在AuraWidgetController.h中
protected:
UPROPERTY(BlueprintReadOnly,Categery="WidgetController")
TObjectPtr<APlayerController>PlayerController;
UPROPERTY(BlueprintReadOnly,Categery="WidgetController")
TObjectPtr<APlayerState>PlayerState;
UPROPERTY(BlueprintReadOnly,Categery="WidgetController")
TObjectPtr<UAbilitySystemComponent>AbilitySystemComponent;
UPROPERTY(BlueprintReadOnly,Categery="WidgetController")
TObjectPtr<UAttributeSet>AttributeSet;
浙公网安备 33010602011771号