Error with reload_current_scene() in 4.2

Godot Version



I just updated to Godot 4.2, and reload_current_scene() will randomly crash the game. It returns the error message “Cannot call method ‘reload_current_scene’ on a null value.” As far as I know, this did not occur in 4.1. I’m very new to Godot, so any help would be appreciated. Thanks!

My code for reloading the scene:
func damage():
for i in get_slide_collision_count():
var collision = get_slide_collision(i)
if collision.get_collider().is_in_group(“Hazard”):

It’s hard to tell without your code formatted, but is the get_tree().reload_current_scene() line inside of the for loop? Is it possible that it’s being called multiple times, but by the time it’s being called again the scene_tree has been deleted to reload the scene? It may be worth using an if statement to check it exists first.

if get_tree():


1 Like

That helped me a lot. Thank you, stranger. May you live in peace and love.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.