Hey,
I’ve come across a strange behaviour when using Able inside an ActorComponent.
UCombatComponent
void UCombatComponent::PerformBasicAttack()
{
UAblAbilityComponent* AbilityComponent = MyCharacterOwner->GetAbilityComponent();
if (!ensure(AbilityComponent != nullptr)) return;
// Create Able Context
UAblAbility* attack = BasicAttack->GetDefaultObject<UAblAbility>();
if(attack == nullptr) { UE_LOG(LogTemp, Error, TEXT("BasicAttack couldn't get Ability Object from given class")); return; }
UAblAbilityContext* context = UAblAbilityContext::MakeContext(attack, AbilityComponent, GetOwner(), GetOwner());
if(context == nullptr) { UE_LOG(LogTemp, Error, TEXT("Couldn't create AbleAbilityContext")); return; }
// Execute Ability
AbilityComponent->ActivateAbility(context);
}
Log
[2020.05.10-12.51.56:607][344]LogWindows: Error: [Callstack] 0x00007ffa30811387 UE4Editor-AbleCore.dll!FAbleLogHelper::GetWorldName() [d:\build\++portal+promotion\sync\localbuilds\plugintemp\hostproject\plugins\able\source\ablecore\private\ablabilityutilities.cpp:103]
[2020.05.10-12.51.56:607][344]LogWindows: Error: [Callstack] 0x00007ffa30814c51 UE4Editor-AbleCore.dll!UAblAbilityComponent::InternalStartAbility() [d:\build\++portal+promotion\sync\localbuilds\plugintemp\hostproject\plugins\able\source\ablecore\private\ablabilitycomponent.cpp:1042]
[2020.05.10-12.51.56:607][344]LogWindows: Error: [Callstack] 0x00007ffa307e5fae UE4Editor-AbleCore.dll!UAblAbilityComponent::ActivateAbility() [d:\build\++portal+promotion\sync\localbuilds\plugintemp\hostproject\plugins\able\source\ablecore\private\ablabilitycomponent.cpp:427]
[2020.05.10-12.51.56:607][344]LogWindows: Error: [Callstack] 0x00007ffab49035f7 UE4Editor-....dll!UCombatComponent::PerformBasicAttack() [E:\...\Core\Character\CombatComponent.cpp:68]
[2020.05.10-12.51.56:607][344]LogWindows: Error: [Callstack] 0x00007ffab4907bc1 UE4Editor-....dll!AMyDefaultController::BasicAttack() [E:\...\Core\Character\MyDefaultController.cpp:88]
Basically moved the code from the Character to it’s own Component. Using it directly from the Character worked fine, but calling it on an ActorComponant results in a crash.
I couldn’t find a flaw in my code (yet), maybe you know more than I do
Greetings