All Questions


Rabbit One
posted to: Coding the State

Autocomplete gives me another Input

What is the difference? My autocomplete for unhandled_input and physics_process gives me this:

func _unhandled_input(event):


func _physics_process(delta):

Why are we adding this?

func _unhandled_input(event: InputEvent) -> void:

I mean, ": InputEvent" and "-> void" parts. Why?


Well, I already searched for an answer here in the Functions section. BUT I got two new questions. Hope you can help me.

Why we need to specify the InputEvent for the argument event and the float for the argument delta? Isn't it a default for newer versions of Godot?

And, why are we specifying the return type of each function? What happens if we don't write the "-> void" part of the function?