-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Equivalent for await $SomeTimer.timeout
?
#432
Comments
This is not possible at the moment. It would need async support, which is unfortunately quite a pain in Rust. gdnative supports it though, it looks like this: So maybe we can reuse prior art here, but it's not a priority at the moment. |
@WHMHammer If you don't mind defining an extra fn show_game_over(&self) {
...
let mut timer = self.base.get_tree().unwrap().create_timer(1.0).unwrap();
timer.connect("timeout".into(), self.base.callable("show_start_button"));
}
#[func]
fn show_start_button(&self) {
self.get_node_as::<Button>("StartButton").show()
} |
@jrockett6 that's actually a great idea. And in other news, I added It's a bit more manual at the moment (you only get a variant slice), so |
@jrockett6 @Bromeon I created additional Timers in Godot editor and set their timeout handlers to the logics after the delays. Thank you for your alternative solutions though! |
Implement timers called out in #432
Shouldn't this stay open until we have proper async support? |
I am following the Godot "Your first 2D game" tutorial. Part of the logic is to wait for a timer to timeout to proceed to the next step. Below are the GDScript codes:
However, I did not find any equivalent function in the godot-rust
Timer
documentation. I also checked the example codes in this repo, which does not have this wait for timeout logic at all. The same issue exists onSceneTreeTimer
.What are the equivalents for
await $SomeTimer.timeout
in godot-rust? Thanks!The text was updated successfully, but these errors were encountered: