I want to create a FPS game. In the game the player will can choose between more characters. So I don’t want to set the input to each character separate. I want to set it in PlayercCntroller (C++ code). If it’s easier to set it in Bleuprint it’s ok, but if it’s possible in code, I prefer that way. Thanks!
You can set the common actions between characters on the PlayerController class and the specific ones on the character class. Just override SetupInputComponent method and set those bindings up
Hi! I’ve add what you said, but it doesn’t work. On the link below says the same, but there the code is written in a Character class.[A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums][1]
Here are two screenshots. I should include something else?
You have to use:
virtual void SetupInputComponent() override;
and not
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
The UInputComponent comes from the PlayerController so that is used on characters controlled by it
P.S: Don’t forget to call Super::SetupInputComponent() when overriding
Thank You very much for help!
You’re welcome
Do maybe know how this is done in Unreal version 4.18.1, in this version this does not work.
It keeps showing the same error as had and it still exists when I use your method.
The error:
Severity Code Description Project File Line Suppression State
Error (active) E1455 member function declared with ‘override’ does not override a base class member EscapeRoom c:\Users\Desktop\Backup\Unreal Engine 4\EscapeRoom\Source\EscapeRoom\PlayerMind.h 23
I want to add the code in a playerController class which header file and cpp file looks like this:
Header:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “GameFramework/PlayerController.h”
#include “PlayerAvatar.h”
#include “PlayerMind.generated.h”
/**
*
*/
UCLASS()
class ESCAPEROOM_API APlayerMind : public APlayerController
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
// Called to bind functionality to input
virtual void SetupInputComponent() override;
//This line of code also gives me the same error.
virtual void SetPawn(APlayerAvatar* playerAvatar) override;
};
The .cpp File:
// Fill out your copyright notice in the Description page of Project Settings.
#include “PlayerMind.h”
// Called to bind functionality to input
void APlayerMind::SetuprInputComponent()
{
Super::SetupInputComponent();
}
I’m using the same code in 4.18.1 and it works fine, what are you using and what error are you getting?
Can you edit your reply and set all of the header file inside a code block so its easier to read? Or just send the files to me.
Was there any resolution to this? I am getting the same error on 4.18.3