reloading a scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JakeCarbine

hello I am trying to reload a my pong game when the game is over here is my code where I execute that behavior:

if Input.is_action_pressed("ui_reset")&&endGame:

here is the error I get in my debugger:

E 0:00:30.599   reload_current_scene: Condition "!current_scene" is true. Returned: ERR_UNCONFIGURED
  <C++ Source>  scene/main/scene_tree.cpp:1319 @ reload_current_scene()
  <Stack Trace> @ _process()

it traces back to that same line. please could you assist me.

:bust_in_silhouette: Reply From: Help me please

better if you try to change scene again to the current scene


That’s how it’s implemented in engine code. So it is hardly possible to give a better answer

Error SceneTree::reload_current_scene() {
	String fname = current_scene->get_filename();
	return change_scene(fname);

Mak | 2021-04-28 15:33

:bust_in_silhouette: Reply From: Suleymanov

Try var _reload = get_tree().reload_current_scene() instead.