Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HandleInputReleasedEvent brakes in UE5.5 #145

Open
d3metrious opened this issue Nov 22, 2024 · 1 comment
Open

HandleInputReleasedEvent brakes in UE5.5 #145

d3metrious opened this issue Nov 22, 2024 · 1 comment

Comments

@d3metrious
Copy link

Input Released Trigger does not fire in UE5.5. Affects gameplay ability WaitInputRelease node.

Solution available from Lyra5.5 project, have not tested replication:

void UCustomGameplayAbility::HandleInputReleasedEvent(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpecHandle SpecHandle)
{
	// Find the Ability Spec based on the passed in information and set a reference.
	if (FGameplayAbilitySpec* Spec = ActorInfo->AbilitySystemComponent->FindAbilitySpecFromHandle(SpecHandle))
	{
		if (UAbilitySystemComponent* AbilitySystemComponent = ActorInfo->AbilitySystemComponent.Get())
		{
			Spec->InputPressed = false;
			
			if (Spec && Spec->IsActive())
			{

				// Lyra 5.5 Solution
				PRAGMA_DISABLE_DEPRECATION_WARNINGS
				const UGameplayAbility* Instance = Spec->GetPrimaryInstance();
				FPredictionKey OriginalPredictionKey = Instance ? Instance->GetCurrentActivationInfo().GetActivationPredictionKey() : Spec->ActivationInfo.GetActivationPredictionKey();
				PRAGMA_ENABLE_DEPRECATION_WARNINGS

				// Invoke the InputReleased event. This is not replicated here. If someone is listening, they may replicate the InputReleased event to the server.
				AbilitySystemComponent->InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputReleased, SpecHandle, OriginalPredictionKey);

				/* Original Method
				if (Spec->Ability.Get()->bReplicateInputDirectly && AbilitySystemComponent->IsOwnerActorAuthoritative() == false)
				{
					AbilitySystemComponent->ServerSetInputReleased(SpecHandle);
				}

				AbilitySystemComponent->AbilitySpecInputReleased(*Spec);

				// Invoke the InputReleased event. This is not replicated here. If someone is listening, they may replicate the InputPressed event to the server.
				AbilitySystemComponent->InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputReleased, SpecHandle, Spec->ActivationInfo.GetActivationPredictionKey());
				*/
			}
		}
	}
}
@aetherspacemind
Copy link

Ah amazing, thanks for the find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants