Hi, this is in the archived unreal course, lecture 90 (input binding) where ben shows us how to bind key strokes and inputs to functions.
so if u take a look in this snippet of code,
void UGrabber::BeginPlay()
{
Super::BeginPlay();
InputComponent = GetOwner()->FindComponentByClass<UInputComponent>();
if (InputComponent) {
InputComponent->BindAction("Grab", EInputEvent::IE_Pressed, this, &UGrabber::Grab);
InputComponent->BindAction("Grab", EInputEvent::IE_Released, this, &UGrabber::Release);
}
}
You’ll find that the input binding is happening in the BeginPlay() function that is only activated in the beginning of the game. But whenever I click the designated button it works without any problems by printing to the console (from the Grab & Release functions). WHY? Since BeginPlay is not a function that is constantly monitoring input every frame like the Tick function, how is it that this key Binding is working?