public virtual void OnGameplayTaskDeactivated(UGameplayTask Task) { // cleanup after deactivation if (Task != ChildTask) { return; } Debug.LogWarning("%s> Child task deactivated: %s (state: %s)"); if (Task.IsFinished()) { ChildTask = null; } }
public virtual void OnGameplayTaskDeactivated(UGameplayTask Task) { bool bIsFinished = Task.IsFinished(); var childTask = Task.GetChildTask(); if (childTask != null && bIsFinished) { if (Task.HasOwnerFinished()) { childTask.TaskOwnerEnded(); } else { childTask.EndTask(); } } if (Task.IsTickingTask()) { // If we are removing our last ticking task, set this component as inactive so it stops ticking TickingTasks.Remove(Task); } if (bIsFinished) { // using RemoveSwap rather than RemoveSingleSwap since a Task can be added // to KnownTasks both when activating as well as unpausing // while removal happens only once. It's cheaper to handle it here. KnownTasks.Remove(Task); } // Resource-using task if (Task.RequiresPriorityOrResourceManagement() && bIsFinished) { OnTaskEnded(Task); } if (!Task.IsOwnedByTasksComponent() && !Task.HasOwnerFinished()) { var TaskOwner = Task.GetTaskOwner(); TaskOwner.OnGameplayTaskDeactivated(Task); } UpdateShouldTick(); }