You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling create_tween() from a method called by call_deferred() immediately after a scene change (e.g. with reload_current_scene), create_tween() returns null.
Steps to reproduce
Create a new Godot project.
Create a scene Node2D with two Area2Ds.
Connect the area_exited signal of one of the Area2Ds to a method called on_area_exited.
Add the following code to the on_area_exited() method:
func _deferred_exited() -> void:
print("Exited ", create_tween())
# If we need use the tween here, a crash is produced.
func on_area_area_exited(_area) -> void:
#_deferred_exited() #<-- this works OK
call_deferred("_deferred_exited") #<-- this create_tween returns null/ in godot 4.1 works OK
Create a button and connect its pressed signal to a method called on_button_pressed().
Add the following code to the on_button_pressed() method:
An internal rework of the change_scene_to_* methods introduces a change in behavior compared to Godot 4.1 (GH-78988).
While previously the transition would happen at the end of the current frame, starting with Godot 4.2 the current scene is removed from the tree immediately. This means there is a brief period when no current_scene is present in the tree, so you may need to adjust your scripts to account for that. See the updated documentation for more details.
However, it's not mentioned anywhere that reload_current_scene is also affected.
Godot version
4.2
System information
Manjaro Linux
Issue description
When calling create_tween() from a method called by call_deferred() immediately after a scene change (e.g. with reload_current_scene), create_tween() returns null.
Steps to reproduce
func _deferred_exited() -> void:
print("Exited ", create_tween())
# If we need use the tween here, a crash is produced.
func on_area_area_exited(_area) -> void:
#_deferred_exited() #<-- this works OK
call_deferred("_deferred_exited") #<-- this create_tween returns null/ in godot 4.1 works OK
func _on_button_pressed() -> void:
get_tree().reload_current_scene()
Minimal reproduction project
reload_scene_tween_bug.tar.gz
The text was updated successfully, but these errors were encountered: