Why the inputcomponent is used in beginplay() and how it’s working whenever we press a button since the beginplay() is called only once and acts like a tickcomponent(). But if I try to write that code in constructor the UE4 crashes. Can anybody explain me this? Thanks
To quote myself from the Q&A this morning.
This function does not call Grab or Release. It merely binds the Action “Grab” with the input event Pressed and Released with the member functions Grab and Release respectively.
This does not call either function.
What its doing is setitng a pointer to member function which will call Grab or release when the input event happens.
Take this code example
This is using pointer to non -member function to make it a bit easier.
Line 17 is effectively what is happening in that function, note if you comment out the rest of main there’s no output because One or Two were never called.
Lines 18 and 21 are what call the functions (through the function pointer).
Here’s a more complicated pointer to member function example
Thanks a lot. With this example I got a better understanding of binding.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.