Download

Question about UInputComponent

[FONT=Times New Roman]Hi guys!

[FONT=Times New Roman]I have a question about UInputComponent.

[FONT=Times New Roman]I am studying the C++ side of Unreal Engine and I am trying to know and understand how it works inside out. Messing around with UInputComponent I discovered that I can create a blank CPP file, add this line to it:

[FONT=Times New Roman]UInputComponent* PlayerInputComponent;

[FONT=Times New Roman]When I build, it says successful. Shouldn’t it fail though? I know that, according to documentation, UInputComponent should require #include “Components/InputComponent.h” to build, yet it successfully builds without it.

[FONT=Times New Roman]So what gives?

[FONT=Times New Roman]Is there another process happening that gives it access to Components/InputComponent.h" so that I can do UInputComponent* PlayerInputComponent; ???

[FONT=Times New Roman]Thank you in advance!

[FONT=Times New Roman]My reference link:
[FONT=Times New Roman]UInputComponent | Unreal Engine Documentation

Pawn.h file is what you want. Line 22 is the define of class UInputComponent; At line 367 AND 373 has 2 functions you will want to use.

You included a file that already included “Components/InputComponent.h” so you didn’t need to include it [again].