4
\$\begingroup\$

According to Google, await ToSignal(GetTree(), "idle_frame"); should wait until the next frame. However, in Godot 4.0's current master branch (mono build!), this fails with:

Ready(): In Object of type 'SceneTree': Attempt to connect nonexistent signal 'idle_frame' to callable 'Node3D(SomeScript.cs)::SignalAwaiterMiddleman::idle_frame'.

It seems like the API changed in Godot 4.0. Do you have any ideas how to wait until either the next frame or until the current frame has finished?

\$\endgroup\$

1 Answer 1

6
\$\begingroup\$

Disclaimer: Mono Build? I haven't tried at the time of writing.

This is the GDScript 2.0 you would be trying to mimic in C#:

await get_tree().process_frame

Thus, I believe in C# it should say:

await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
\$\endgroup\$
2
  • \$\begingroup\$ Just playing around with Godot 4.0's Mono Build - it is running pretty stable compared to two/three months ago. \$\endgroup\$ Oct 28, 2021 at 7:52
  • 2
    \$\begingroup\$ Slight tweak to this: await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame); does the same thing without a string literal. Not a big deal, but feels a little closer to what you get with GDScript. \$\endgroup\$
    – jakecard
    Sep 19, 2023 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .