UE4:[C++]ActionMappingの取得
アクションマッピングで設定したキーをC++で呼び出します。
色々と調べながらなのでアレかもしれません。動きはしました。
BPに慣れすぎるとコンパイル時間が長く感じますね。効率が悪い。
input.h private: UInputComponent* InputComponent = nullptr; void InputEvent(); input.cpp void UInput::BeginPlay() { Super::BeginPlay(); //入力を取得 InputComponent = GetOwner()->FindComponentByClass<UInputComponent>(); //取得できた場合の処理 if(InputComponent){ InputComponent->BindAction("InputMappings", IE_Pressed, this, &UInput::InputEvent); } // ... } void UInput::InputEvent() { UE_LOG(LogTemp, Warning, TEXT("入力ゲット!")) }
このブログはBPのみとしたいので近々他のブログに移すと思います。