Skip to content

HandleInputReleasedEvent brakes in UE5.5 #145

Description

@d3metrious

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());
				*/
			}
		}
	}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions