Editor crash after close due to abilitytask

Sinde I created an abilitytask and use it in gameplayability , everytime I close the editor , it crashed. Here are the Crash Reporter:

LoginId:f777312e4e84f04ce0175489724f0■■■
EpicAccountId:b774b9417555447e9f02e69a5d3747ef

Assertion failed: GlobalAbilityTaskCount > 0 [File:D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Private\Abilities\Tasks\AbilityTask.cpp] [Line: 136] Mismatched AbilityTask counting

UnrealEditor_GameplayAbilities!UAbilityTask::BeginDestroy() [D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Private\Abilities\Tasks\AbilityTask.cpp:136]
UnrealEditor_CoreUObject!UObject::ConditionalBeginDestroy() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1024]
UnrealEditor_CoreUObject!UnhashUnreachableObjects() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp:2616]
UnrealEditor_CoreUObject!IncrementalPurgeGarbage() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp:1765]
UnrealEditor_CoreUObject!StaticExit() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:4888]
UnrealEditor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:739]
UnrealEditor!TMulticastDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::Broadcast() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:975]
UnrealEditor!FEngineLoop::AppPreExit() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:6295]
UnrealEditor!FEngineLoop::Exit() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4594]
UnrealEditor!GuardedMain() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:216]
UnrealEditor!GuardedMainWrapper() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:107]
UnrealEditor!LaunchWindowsStartup() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:244]
UnrealEditor!WinMain() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:282]
UnrealEditor!__scrt_common_main_seh() [D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Does anyone got an idea?

The abilityTask(AbilityTask_WaitForInteractableTargets , UAbilityTask_WaitForInteractableTargets_SingleLineTrace) is copied from Lyra Project , and used in the Ability_Interact just like Lyra.

Did you ever figure this out? I’m having a similar issue.

No, I haven’t figure it out. As long as I do not open that gameplay ability blueprint, it will not happen.
I think it is related to the uninitialzation of the gameplayabilitytask that editor created.

Hello,
Getting the same error without custom Task. :slight_smile:
My version : 5.1.1

Did someone figure out ?

Thank you.

I had this problem too on a custom Gameplay Task, and managed to resolve it by making sure EndTask() was not being called twice for the same ability task. More specifically in my case, EndTask() called a function on another object, which in turn called EndTask() again before the task was even fully destroyed. I hope this helps! :smiley:

2 Likes

When searching for this in code, there is a comment stating that if you are seeing this message that a ability was destroyed while being active.

If there is a Ability Task in my project, and If working with Live Coding, the editor will usually always crash on close with this “Assertion failed: GlobalAbilityTaskCount > 0” message. I can get this to happen in a fresh install of Lyra, and also in a blank project that has the Gameplay Abilities plugin enabled and a UAbilityTask class added. I have tested this on two computers. Live Coding and Ability Task do not play nice together.

When testing in the Lyra project, anything done to most of the classes within the LyraGame folder will cause this crash on editor close when compiling with Live Coding. It does not even need to be a code change. This includes LyraCharacter, LyraCharacterMovementComponent, and LyraCameraMode. It does not seem to break the project because it still can be compiled and packaged. If the LyraGame/Interaction/Tasks folder is removed, the crashing stops. And if any of the task are put back, the crashing returns

I think that the crashes I’m dealing with are mentioned at the very end of the Live Coding docs. It also mentions working with two new delegates that were added in 5.1, but there is no info on how, where, or if they should be used here. There not used anywhere in the Lyra project.

1 Like

Hello, the 5.2 version I am currently using also has this problem, my solution is to remove the parameters corresponding to the constructor of the custom C++Task class, like this, and then test again without crashing after closing the editor. I hope it was helpful.
image

2 Likes

Hi there @Septsaber0,

This topic has been moved from International to Programming & Scripting.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing!

I modify my code according to your method, but It s crash occasionally too.
UE 5.2.1