공부/UE

[UE] 각종 Ability가 GAS의 ActorInfo에 접근할 수 있는 이유

sudo 2025. 9. 20. 15:12
반응형

GetAbilitySystemComponentFromActorInfo_Checked() 함수는 CurrentActorInfo를 통해 AbilitySystemComponent에 접근할 수 있다.

그럼 CurrentActorInfo는 언제 세팅된건지 파악해보면

 

게임 시작 직후에 Player가 빙의될 때, AbilitySystemComponent가 블프로 세팅한 각 어빌리티들에 대해 GiveAbility를 호출해주고 있다. 이때 FGameplayAbilitySpec타입의 FGameplayAbilitySpec을 전달해준다

 

 

코드를 타고 들어가다보면 UAbilitySystemComponent::OnGiveAbility 내에서 각 어빌리티들에게 자신이 갖고 있는 AbilityActorInfo를 넘겨준다. 

그럼 ASC는 언제 CurrentActorInfo를 갖고 있게 된걸까?

 

ActorComponent에서 ASC를 등록하고 OnRegister를 호출하면 등록해주네

반응형