The example in documentation doesnt work - has the function name changed?

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

Hi,
Still new to godot, and was following this:

_input_event(evt) never gets called for me.

if i change it to : _input(evt) then “type” doesnt exist on InputEventMouseMotion

I then thought about adding functionality via the GUI interface, so I clicked my Control node and then under the menu tab Node i double clicked, and added, the functions for mouse_entered() and gui_input()

mouse_entered gave me _on_Interface_mouse_entered - which worked.

gui_input gave me _on_Interface_gui_input(ev) - which worked and fired events for InputEventMouseButton and InputEventMouseMotion
But again if i try to do “ev.type” I get an error :

Invalid get index ‘type’ (on base: InputEventMouseMotion)

Is the docs 100% correct, and I’m having different issues with the original _input_event() func? And what is going on with the other functions and the event obj having no “type”?

Also, it would be great if I could copy the error message from the Debug panel ?

:bust_in_silhouette: Reply From: exuin

Well, Godot 2 was years ago. At this point any tutorials on it are sure to be horribly outdated. You should check a Godot 3 tutorial. Control nodes no longer have a _input_event method and instead have a _gui_input method that can be overridden without having to connect a signal. And InputEvents no longer have a type property. They have a bunch of other properties you can use though.

I’m sure the Godot 2 doc was correct when it came out. In 2016. And you can copy the error message from the debug panel by right-clicking on it and clicking “Copy Error”.