Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to debug input events #3057

Open
balloonpopper opened this issue Jul 29, 2021 · 1 comment
Open

Add functionality to debug input events #3057

balloonpopper opened this issue Jul 29, 2021 · 1 comment

Comments

@balloonpopper
Copy link

Describe the project you are working on

3D Tycoon game

Describe the problem or limitation you are having in your project

As discussed in issue 50701 if you have a area with "ray pickable" enabled but do not connect the input_event signal on it, the area will intercept any mouse clicks (running in STOP rather than PASS mode like other Godot events) but there will be no indication of what absorbed the mouse click. You can't step through the code to find where the click went as the 'input event' isn't linked to any code, and there is no way to have the Godot GUI act as if a breakpoint is set immediately when an event is received. There is no easy way to debug events.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The proposal is to implement some way to debug events. The suggestion on 50701 was that the feature "could be used to track down events and how they are stopped, not just for physics, but for ui in general. It could be a project option, or an option in the debug menu."

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

My thought was that when the "debug input events" option was enabled, a line of debug output would be printed when an input event was (a) evaluated, and (b) when it encountered a "STOP" condition. The node that interacted with the event would be printed in the output.

There should be a way to specify the event you want to debug. e.g. I might want to debug a right click only, or a custom "accelerate" event I've created.

There would be a way to disable/enable this via GDScript. If you have a bug you're trying to track down that only occurs the 5th time you invoke a menu for example, if you could turn on the feature via code after the 4th invocation, it would make debugging a lot simpler.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

The debugger is central to the engine.

@balloonpopper balloonpopper changed the title Debugging input events Functionality to debug input events Jul 29, 2021
@Calinou Calinou changed the title Functionality to debug input events Add functionality to debug input events Jul 29, 2021
@Calinou
Copy link
Member

Calinou commented Jan 2, 2022

The Debugger > Misc tab tells you which node was clicked while a project is running:

image

I suppose we could improve this tab to make it more descriptive, but the base functionality (knowing which node received the input) is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants