@@ -143,7 +143,7 @@ Features:
143143- apply ` InitialGameplayTags `
144144- Lyra-like "InputConfig", GAS abilities input binding
145145
146- ##### InputConfig (GAS abilities input binding)
146+ ##### InputConfig (GAS abilities input binding) [ optional ]
147147
148148Binding InputActions to GameplayAbilities using tags, like in Lyra but enhanced and adopted for 3d action game.
149149
@@ -155,9 +155,10 @@ Setup:
155155- create ` InputConfig ` - ` DataAsset ` nested from ` UHLInputConfig `
156156- abilities should nest from ` UHLGameplayAbility ` for ` ActivationPolicy ` work correctly
157157- in ` Project Settings -> Input -> Default Input Component Class ` -> set ` UHLInputComponent `
158- - in your PlayerCharacter class add lines in ` SetupPlayerInputComponent ` for bind actions from ` InputConfig `
158+ - in your PlayerCharacter class add lines in ` SetupPlayerInputComponent ` for binding actions from ` InputConfig `
159159
160160``` c++
161+ // Your PlayerCharacter class
161162void AUHLPlayerCharacter::SetupPlayerInputComponent (UInputComponent* PlayerInputComponent)
162163{
163164 Super::SetupPlayerInputComponent(PlayerInputComponent);
@@ -167,6 +168,7 @@ void AUHLPlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInput
167168 TArray<uint32> BindHandles;
168169 UHLInputComponent->BindAbilityActions(UHLInputConfig, AbilitySystemComponent, &UUHLAbilitySystemComponent::AbilityInputTagPressed, &UUHLAbilitySystemComponent::AbilityInputTagReleased, BindHandles);
169170
171+ // optional
170172 if (UHLInputComponent)
171173 {
172174 UHLInputComponent->BindAction(UHLInputConfig->NativeInputAction_Move.InputAction, ETriggerEvent::Triggered, this, &AUHLPlayerCharacter::InputMove);
@@ -178,6 +180,49 @@ void AUHLPlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInput
178180}
179181```
180182
183+ - in your PlayerController class add
184+
185+ ```c++
186+ // Your PlayerController.cpp
187+ void AUHLPlayerController::OnPossess(APawn* InPawn)
188+ {
189+ Super::OnPossess(InPawn);
190+
191+ CachedPlayerCharacter = Cast<AUHLPlayerCharacter>(InPawn);
192+ }
193+
194+ void AUHLPlayerController::PostProcessInput(const float DeltaTime, const bool bGamePaused)
195+ {
196+ Super::PostProcessInput(DeltaTime, bGamePaused);
197+
198+ if (CachedPlayerCharacter.Get() == nullptr) return;
199+
200+ if (UUHLAbilitySystemComponent* ASC = CachedPlayerCharacter.Get()->GetUHLAbilitySystemComponent())
201+ {
202+ ASC->ProcessAbilityInput(DeltaTime, bGamePaused);
203+ }
204+ }
205+
206+
207+
208+ // Your PlayerController.h
209+ UCLASS()
210+ class UHL_API AUHLPlayerController : public APlayerController
211+ {
212+ GENERATED_BODY()
213+
214+ protected:
215+ virtual void OnPossess(APawn* InPawn) override;
216+ virtual void PostProcessInput(const float DeltaTime, const bool bGamePaused) override;
217+
218+ private:
219+ TWeakObjectPtr<AUHLPlayerCharacter> CachedPlayerCharacter;
220+ };
221+ ```
222+
223+ How to use:
224+ - every ` UHLGameplayAbility `
225+
181226##### AbilityInputCache
182227
183228` AbilityInputCache `
0 commit comments