From d51ec249387ecfe53661b87355e96c2f093700c5 Mon Sep 17 00:00:00 2001 From: Ji Yoon Rhee Date: Sat, 8 Jun 2024 23:26:38 +0900 Subject: [PATCH] set up input mapping in hwanyoung2 character --- hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h | 4 ++++ hwanyoung2/Source/hwanyoung2/hwanyoung2Character.cpp | 4 +++- hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h b/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h index cebb931b..dd31736b 100644 --- a/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h +++ b/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h @@ -44,6 +44,10 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 InventoryWeightLimit; + /** MappingContext */ + UPROPERTY(EditAnywhere, Category = Input, meta = (AllowPrivateAccess = "true")) + class UInputMappingContext* InputMapping; + /** Toggle inventory GUI Input Action */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) class UInputAction* ToggleInventoryAction; diff --git a/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.cpp b/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.cpp index 19089797..f8555b8f 100644 --- a/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.cpp +++ b/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.cpp @@ -50,9 +50,11 @@ void Ahwanyoung2Character::BeginPlay() { if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem(PlayerController->GetLocalPlayer())) { - Subsystem->AddMappingContext(DefaultMappingContext, 0); + Subsystem->AddMappingContext(InputMapping, 0); } } + + } void Ahwanyoung2Character::CheckForInteractables() diff --git a/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h b/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h index 872bb5d7..66f0387e 100644 --- a/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h +++ b/hwanyoung2/Source/hwanyoung2/hwanyoung2Character.h @@ -4,7 +4,7 @@ #include "CoreMinimal.h" #include "GameFramework/Character.h" -#include "InputActionValue.h" +#include "InputAction.h" #include "hwanyoung2.h" #include "hwanyoung2Character.generated.h" @@ -28,8 +28,8 @@ class Ahwanyoung2Character : public ACharacter #pragma region Character Gameplay Input Action /** MappingContext */ - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) - class UInputMappingContext* DefaultMappingContext; + UPROPERTY(EditAnywhere, Category = Input, meta = (AllowPrivateAccess = "true")) + class UInputMappingContext* InputMapping; /** Jump Input Action */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))