my SetupInputComponent wasnt overridden from the base class , because when i did i got a build error saying that the base class did not contain a function named SetupInputComponent.
Same happened for me. The AGameController constructor is too early for registration, because the InputComponent was nullptr, because AActor::EnableInput(APlayerController* PlayerController) is not called. I tried that manually, now this is not throwing an exception, but did not work (4.7.2):
UCLASS()
class BUTTONFOOTBALL_API AGameController : public APlayerController
{
GENERATED_BODY()
public:
AGameController(const FObjectInitializer& ObjectInitializer);
virtual void SetupInputComponent() override;
void OnFirePressed();
};
The constructor isn’t the problem. I already tried the beginplay and the InputComponent was nullptr… If I call the hack(??) (AActor::EnableInput(this)), I got some assert and it did not response to my action
Is that controller possessing or spawning a pawn? You should be feeding the input you get to a pawn you are controlling or referencing instead of calling that function.
link text, read up a bit about pawns and controllers to get an idea of what is happening. I haven’t looked it up but I believe you are referencing a non static function in a static way, ie what actor are you trying to enable input on, and what are you trying to do as a whole. There are many examples out there that can help you get started on setting up controllers.