-
-
Notifications
You must be signed in to change notification settings - Fork 97
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 a warning when someone calls Input.is_action ... in _input(event) #316
Comments
Not related to the issue, but is there an alternative besides using event.is_action? I've had buggy behavior using that (events stop being sent after 1 second, making it impossible to tell if an action is held or not). Is Input meant to be used in _physics_process instead, or can it be called multiple times there, too? |
@regakakobigman To my understanding, you should be able to tell if an input is held or not based on whether the |
I use |
Although: Please note: |
This is exactly why I would not recommend _input(event) for beginners unless they are able to and want to read the source code about what is going on. I can't read the source code to understand what's going on and the docs are not helping either. Which is why even though I'm using Godot now for a year and a halve, I still much rather use Input.is_action ... in the process loop. |
Really? That's terribly misleading. |
It's something to keep in mind. If you want to know if two buttons have been pressed at the same time, Input.is_action_just_... is the way to go. (e.g. for combos in a fighting game) |
Describe the project you are working on:
Projects with Input events and Input maps
Describe the problem or limitation you are having in your project:
I was not aware about the fact that
Input.is_action_just_pressed("action")
could be called multiple times per frame, but thanks to this post on reddit I was made aware.Describe how this feature / enhancement will help you overcome this problem or limitation:
A yellow warning would be nice to tell me about the risk and the recommended alternative.
Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
something like:
"Using Input.is_action ... calls in _input(event) might get called more than once per frame. Use event.is_action('my_action') instead"
Describe implementation detail for your proposal (in code), if possible:
not possible
If this enhancement will not be used often, can it be worked around with a few lines of script?:
used often by those not aware
Is there a reason why this should be core and not an add-on in the asset library?:
to help people not to create unnecessary bugs
The text was updated successfully, but these errors were encountered: