0 votes


I wonder, when the engine is updating its input state?

In Unity (Which I used before), you may miss some inputs, if you query them in Unitys "physicsprocess" function, because the engine updates the input state once a frame and this is not always a tick of the physics engine.

So, I try to find out, if this is a potential problem in Godot, too. But I don't find much information about how the game loop works internally.



in Engine by (22 points)

1 Answer

0 votes

Ok, first of all: If you don't want to miss a thing, then you can use event driven Input Management:

To my personal experience I would say that input actions are event driven and therefore don't care much about screen frames. Anyway, you're free to have a look at the source code yourself:

I didn't go very deep but I can at least see that physicsframes are taken into account:
(from main/input

bool InputDefault::is_action_just_pressed(const StringName &p_action) const {

    const Map<StringName, Action>::Element *E = action_state.find(p_action);
    if (!E)
        return false;

    if (Engine::get_singleton()->is_in_physics_frame()) {
        return E->get().pressed && E->get().physics_frame == Engine::get_singleton()->get_physics_frames();
    } else {
        return E->get().pressed && E->get().idle_frame == Engine::get_singleton()->get_idle_frames();

Just be aware, that this may vary by platform. (I mean, it may be different on Android/iOS)

Viele Grüße

by (3,358 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.