unitysamples / LyraStarterGame /Plugins /CommonGame /Source /Public /Actions /AsyncAction_CreateWidgetAsync.h
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class APlayerController; | |
| class UGameInstance; | |
| class UUserWidget; | |
| class UWorld; | |
| struct FFrame; | |
| struct FStreamableHandle; | |
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCreateWidgetAsyncDelegate, UUserWidget*, UserWidget); | |
| /** | |
| * Load the widget class asynchronously, the instance the widget after the loading completes, and return it on OnComplete. | |
| */ | |
| UCLASS(MinimalAPI, BlueprintType) | |
| class UAsyncAction_CreateWidgetAsync : public UCancellableAsyncAction | |
| { | |
| GENERATED_UCLASS_BODY() | |
| public: | |
| UE_API virtual void Cancel() override; | |
| UFUNCTION(BlueprintCallable, BlueprintCosmetic, meta=(WorldContext = "WorldContextObject", BlueprintInternalUseOnly="true")) | |
| static UE_API UAsyncAction_CreateWidgetAsync* CreateWidgetAsync(UObject* WorldContextObject, TSoftClassPtr<UUserWidget> UserWidgetSoftClass, APlayerController* OwningPlayer, bool bSuspendInputUntilComplete = true); | |
| UE_API virtual void Activate() override; | |
| public: | |
| UPROPERTY(BlueprintAssignable) | |
| FCreateWidgetAsyncDelegate OnComplete; | |
| private: | |
| void OnWidgetLoaded(); | |
| FName SuspendInputToken; | |
| TWeakObjectPtr<APlayerController> OwningPlayer; | |
| TWeakObjectPtr<UWorld> World; | |
| TWeakObjectPtr<UGameInstance> GameInstance; | |
| bool bSuspendInputUntilComplete; | |
| TSoftClassPtr<UUserWidget> UserWidgetSoftClass; | |
| TSharedPtr<FStreamableHandle> StreamingHandle; | |
| }; | |