fix(collection): 收集Widget补NativeDestruct清理计时器
This commit is contained in:
@@ -11,6 +11,19 @@ void UCollectionCompleteWidget::NativeOnInitialized()
|
||||
Super::NativeOnInitialized();
|
||||
}
|
||||
|
||||
void UCollectionCompleteWidget::NativeDestruct()
|
||||
{
|
||||
// 清理计时器:StayTimer/FadeOutTimer 的 lambda 捕获裸 this,Widget 销毁后 fire 会野指针
|
||||
// (与 CollectionHUDComponent::EndPlay 同类卫生写法,防关卡切换/退 PIE 时的悬挂 timer)
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
World->GetTimerManager().ClearTimer(StayTimerHandle);
|
||||
World->GetTimerManager().ClearTimer(FadeOutTimerHandle);
|
||||
}
|
||||
|
||||
Super::NativeDestruct();
|
||||
}
|
||||
|
||||
void UCollectionCompleteWidget::ShowComplete(const FString& Text, float DisplayDuration, float InFadeOutDuration)
|
||||
{
|
||||
CachedFadeOutDuration = InFadeOutDuration;
|
||||
|
||||
Reference in New Issue
Block a user