ASC->SpawnedTargetActors 에 추가된 타겟 액터에 관해서 질문있습니다.
6강의 ABAT_Trace의 FinalizeTargetActor() 함수에서, 이하와 같이 생성완료된 타겟 액터를 오너 캐릭터의 ASC의 SpawnedTargetActors에 추가했는데, Ability Task가 종료될때 SpawnedTargetActors에서 제거하지 않아도 괜찮을까요?
void UABAT_Trace::FinalizeTargetActor()
{
UAbilitySystemComponent* ASC = AbilitySystemComponent.Get();
if (ASC)
{
const FTransform SpawnTransform = ASC->GetAvatarActor()->GetTransform();
SpawnedTargetActor->FinishSpawning(SpawnTransform);
ASC->SpawnedTargetActors.Push(SpawnedTargetActor);
SpawnedTargetActor->StartTargeting(Ability);
SpawnedTargetActor->ConfirmTargeting();
}
}
혹시나 삭제해야 한다면 타겟 액터 콜백 함수에서 EndTask() 의 실행 직전에 삭제하면 되는지 궁금합니다.
void UABAT_Trace::OnTargetDataReadyCallback(const FGameplayAbilityTargetDataHandle& DataHandle)
{
if (ShouldBroadcastAbilityTaskDelegates())
{
OnComplete.Broadcast(DataHandle);
}
// 추가한 부분
UAbilitySystemComponent* ASC = AbilitySystemComponent.Get();
if (ASC)
{
ASC->SpawnedTargetActors.Remove(SpawnedTargetActor);
}
EndTask();
}
답변 1
1
네. 좋은 질문이십니다.
Target을 Confirm하거나 Cancel하면 타겟 액터 목록은 리셋됩니다.
따라서 별도로 제거할 필요는 없습니다.
void UAbilitySystemComponent::TargetConfirm()
{
// Callbacks may modify the spawned target actor array so iterate over a copy instead
TArray<AGameplayAbilityTargetActor*> LocalTargetActors = SpawnedTargetActors;
SpawnedTargetActors.Reset();
for (AGameplayAbilityTargetActor* TargetActor : LocalTargetActors)
{
if (TargetActor)
{
if (TargetActor->IsConfirmTargetingAllowed())
{
//TODO: There might not be any cases where this bool is false
if (!TargetActor->bDestroyOnConfirmation)
{
SpawnedTargetActors.Add(TargetActor);
}
TargetActor->ConfirmTargeting();
}
else
{
SpawnedTargetActors.Add(TargetActor);
}
}
}
}
void UAbilitySystemComponent::TargetCancel()
{
// Callbacks may modify the spawned target actor array so iterate over a copy instead
TArray<AGameplayAbilityTargetActor*> LocalTargetActors = SpawnedTargetActors;
SpawnedTargetActors.Reset();
for (AGameplayAbilityTargetActor* TargetActor : LocalTargetActors)
{
if (TargetActor)
{
TargetActor->CancelTargeting();
}
}
}
OnInterruptedCallback()으로 몽타주가 중간에 취소될 경우 CancelAbility를 호출하는게 맞을까요 ?
0
38
1
HasMatchingGameplayTag 역활이 조금 이해가 안갑니다.
0
45
1
캐릭터 스탯 초기 설정 방법 질문
0
86
2
언라얼 공식 홈페이지 튜토리얼 강의에 질문 있습니다
0
84
2
StartAbility, StartInputAbility 둘 다 GiveAbility를 호출해야하나요?
0
75
2
AnimNotify 구현 질문
0
103
2
[6강] ShowDebug에서 Attributes for avater가 변하지 않아요..
0
79
2
4강에서 콤보 공격시 다음 공격을 할 경우 ActivateAbility가 자동으로 발동되는 이유
0
112
2
9강 44:59 부분에서 질문이 있습니다.
0
78
2
8강 24:22 CurrentAttributeSet 질문입니다.
0
65
2
ASC 에서 AttributeSet 함수에 대한 mutable 반환 함수가 없는 이유
0
85
2
SetupGASInputComponent 함수 호출위치가 이해가안갑니다.
0
145
3
[GAS] Player State에 대해 궁금한 점이 있습니다.
0
134
2
AnimNotify를 GA에서 받는방법이 있을까요?
0
84
2
ABP의 skeleton 오류
0
115
1
장판스킬을 만들때 콜리전설정
0
174
2
어빌리티의 쿨다운 GameEffect에 대하여
0
261
2
GAS 구조로 멀티 플레이 게임을 제작할려고 하는데요
0
227
2
5.4버전 기준으로 Remove Gameplay Effect With Tags가 안 보입니다.
0
282
3
8강의 수업 내용들 중 이해가 잘 안가는 부분들이 있습니다.
0
209
2
7강 GE로 NonPlayer의 어트리뷰트셋 값을 초기화시키는 것에 질문이 있습니다.
0
111
2
7강 정리했는데 검토부탁드려요
0
125
1
5강 정리해봤는데 검토부탁드립니다.
0
134
2
4강의 CreateTask 함수 질문입니다,
0
158
2





