v1.0.0: The one for Godot 4
Godot 4 is finally oficially out! This calls for a bump on our major release, a change on our main branch, and a new feature that was previously impossible to implement in Godot 3:
Callbacks
Since GDScript now supports Callables, we can easily send functions as parameters in our transition options. This allows a pretty useful pattern to be easily implemented: Callbacks.
If you want some snippet of code to run at specific moments of a transition, you can send it inside of a callable like so:
SceneManager.change_scene("res://demo/test2.tscn", {
"on_tree_enter": func(scene): print("wow I just entered the tree!")
})
This is somewhat similar to how you could use Signals before, but the main advantage is that you can execute code declared in nodes that are already unmounted.
There are 4 currently available callbacks:
- "on_tree_enter": called when the new scene enters the tree
- "on_ready": called when the new scene is ready
- "on_fade_out": called when the fade_out is complete (screen is completely black)
- "on_fade_in": called when the fade_in is complete (transition is completely finished)