Synchronize Inputs Events

Waits for all input events to be processed by flushing any buffered input events and then awaiting a full cycle of both the process and physics frames.

This is typically used to ensure that any simulated or queued inputs are fully processed before proceeding with the next steps in the scene.
It’s essential for reliable input simulation or when synchronizing logic based on inputs.

await_input_processed

The await_input_processed function do wait until all input events are processed.

  • ### Waits for all input events are processed
    func await_input_processed() -> void:
    

    Here is an example of how to use simulate_frames:

    var runner := scene_runner("res://test_scene.tscn")
    
    # Simulates key combination ctrl+C is pressed
    runner.simulate_key_pressed(KEY_C, false, true)
    
    # finalize the input event processing
    await await_input_processed()
    
  • /// <summary>
    /// A utility to synchronize the current thread with the Godot render thread.
    /// This can be used to await the completion of a single render frame in Godot.
    /// </summary>
    public static SignalAwaiter SyncProcessFrame
    

    Here is an example of how to use SimulateFrames:

    ISceneRunner runner = ISceneRunner.Load("res://test_scene.tscn");
    
    // Simulates key combination ctrl+C is pressed
    runner
        .SimulateKeyPress(Key.Ctrl)
        .SimulateKeyPress(Key.C);
    
    // finalize the input event processing
    await ISceneRunner.SyncProcessFrame;
    

document version v4.4.0


Copyright © 2021-2024 Mike Schulze. Distributed by an MIT license.