Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e58ef3

Browse files
committed
Update CustomGameplayAbility.cpp
Missing fix for 5.5 access to Activation info.
1 parentbaa9234 commit2e58ef3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎Source/GAS_Example/AbilitySystem/GameplayAbilities/CustomGameplayAbility.cpp‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include"EnhancedInputComponent.h"
77
#include"GAS_Example/Characters/CharacterBase.h"
88

9+
#defineLOCTEXT_NAMESPACE"GameplayAbility"
910

1011
UCustomGameplayAbility::UCustomGameplayAbility()
1112
{
@@ -119,15 +120,21 @@ void UCustomGameplayAbility::HandleInputPressedEvent(const FGameplayAbilityActor
119120
return;
120121
}
121122

123+
if (!Spec->GetPrimaryInstance(),
124+
TEXT("%hs called on the CDO. NonInstanced abilities are deprecated, thus we always expect this to be called on an instanced object."), __func__)
125+
{
126+
return;
127+
}
128+
122129
if (Spec->Ability->bReplicateInputDirectly && !AbilitySystemComponent->IsOwnerActorAuthoritative())
123130
{
124-
AbilitySystemComponent->ServerSetInputPressed(Spec->Ability.Get()->GetCurrentAbilitySpecHandle());
131+
AbilitySystemComponent->ServerSetInputPressed(Spec->GetPrimaryInstance()->GetCurrentAbilitySpecHandle());
125132
}
126133

127134
AbilitySystemComponent->AbilitySpecInputPressed(*Spec);
128135

129136
// Invoke the InputPressed event. This is not replicated here. If someone is listening, they may replicate the InputPressed event to the server.
130-
AbilitySystemComponent->InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputPressed, Spec->Handle, Spec->ActivationInfo.GetActivationPredictionKey());
137+
AbilitySystemComponent->InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputPressed, Spec->Handle, Spec->GetPrimaryInstance()->GetCurrentActivationInfo().GetActivationPredictionKey());
131138
}
132139

133140
voidUCustomGameplayAbility::HandleInputReleasedEvent(const FGameplayAbilityActorInfo* ActorInfo,const FGameplayAbilitySpecHandle SpecHandle)
@@ -182,3 +189,4 @@ void UCustomGameplayAbility::K0_OnRemoveAbility_Implementation(const FGameplayAb
182189
{
183190
K0_OnRemoveAbility(ActorInfo, Spec);
184191
}
192+
#undef LOCTEXT_NAMESPACE

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp