Difference between _input and _unhandled_input functions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TopBat69

Beginner here

Can someone briefly explain me the difference between _input and _unhandled_input functions in gdscript

Thanks in advance =)

:bust_in_silhouette: Reply From: Gluon

An input is an event which has been assigned some kind of characteristic.

The system will first check if an input is assigned a function, if not it will check if it is a control input (e.g. a control pad) and finally it will check if it is a collision object (only relevant to things like area 2d’s etc). If it hasnt done anything with any of these it is an unhandled input.

For example lets say you havent assigned P to anything, when the user clicks P it will run through that and conclude there is no handling of the event and go to any code you have for unhandled events. Now if you go to key mapping and assign P to a function like pause, the game will check and find it is assigned to a function so it will never fall to an unhandled event code.

2 Likes