choosing between _proccess vs _input for input

Christopher Grossheim(ChrisTrent1)

Hello thanks for doing what you do, I was wondering what are the differences between handling input in a _proccess function vs handling them in an _input function?

1 love
  • Nathan Lovato replied

    The input functions get called once for each input event on each node, starting from the top of the scene tree. Any node in the tree can mark that input as handled, preventing others from receiving and reacting to the input. This is best for one-time events like pressing the spacebar to start a jump or clicking on an NPC to interact with it.

    In process functions it's different. You can check for the current state of the player's input, like the buttons that are down and where the joystick is. The function gets called once per frame or physics frame, which is convenient for movement and anything you need to calculate every frame and that involves player input.

    1 love