How the Inputcomponent get's read

I understand that everything we want to run every frame must be inside the TickComponent function. However, it seems a bit confusing that whenever I hit the Input I set for “grabbing” I get a reading and logging out from a function “Grab” that’s not running every frame. To me that means that SetupInputComponent() is also running every frame somehow.
Is it perhaps it’s being called on an event from another component that’s reading my mouse and keyboard action on every frame? Therefore, it wont matter if we are setting up the component on every frame or just once on begin play, because an external component already knows what to do on begin play and it’s going to use those functions when needed?
Its hard for me to explain because obviously I’m not fully understanding. Let me know if you need and I could try to rephrase it.

Had this question on Udemy yesterday so to repeat myself:

You aren’t calling Grab in BeginPlay. You are binding a member function and instance to call it on to an action name and input event. So when that action is pressed that function will be called on that instance.

Here is a demonstration

https://godbolt.org/z/xMMbb8

Note lines 37 and 41 and how calling those BindX functions (lines 53 and 56) produce no output, because Foo and Bar aren’t being called. If you uncomment lines 55 and 58 which calls Simulate you will get Foo and Bar in the output.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms