Return array to Blueprint

Hello!

I’m trying to return an array from a c++ function to blueprint from an existing function in the Gameplay Ability System:

TArray<FGameplayAbilitySpec*> AbilitiesToActivate;
GetActivatableGameplayAbilitySpecsByAllMatchingTags(GameplayTagContainer, AbilitiesToActivate);

But I don’t see a way to return to blueprint an array with the * inside the type and don’t know how to change it to a reference…

Also tried to make a similar function but always get an error of type or related to * and &:

TArray<FGameplayAbilitySpec&> ANW_ModularCharacter::GetActivatableGameplayAbilitiesByAllMatchingTags(const FGameplayTagContainer& GameplayTagContainer)
{
    UE_LOG(LogTemp, Warning, TEXT("GetActivatableGameplayAbilitiesByAllMatchingTags"));


    TArray<FGameplayAbilitySpec&> MatchingGameplayAbilities;

    for (const FGameplayAbilitySpec& Spec : AbilitySystemComponent->GetActivatableAbilities())
    {
        if (Spec.Ability && Spec.Ability->AbilityTags.HasAll(GameplayTagContainer))
        {
                MatchingGameplayAbilities.Add(const_cast<FGameplayAbilitySpec&>(Spec));
        }
    }
return MatchingGameplayAbilities;
}

Any help would be appreciated!

Blueprint does not support pointers to structs. You must return the array of structs by value, copying each ability spec.