Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | p3drac0 |
Hey, I’m new and I was doing several tutorials when i found the error in the title
I wrote a code where if a ball gets out of the screen, several things happen:
func _on_VisibilityNotifier2D_screen_exited():
var replay_scn = load("res://title/replay.tscn")
lose_s.play()
get_tree().paused = true
yield(lose_s,"finished")
queue_free()
get_parent().add_child(replay_scn.instance())
there is a part of the code when I press a button
func _input(event):
if event.is_action_pressed("iniciar") and not iniciado :
iniciado=true
linear_velocity=Vector2(50,-500)
start_s.play()
set_as_toplevel(true)
elif event.is_action_pressed("iniciar") and iniciado==true :
get_tree().change_scene("res://World.tscn") ###ERROR HAPPENS HERE####
start_s.play()
set_as_toplevel(true)
get_tree().paused=false
When I change the scene in this point, the following error appears
can_process: “!is_inside_tree()” is true. Returned: false
and after that I am not able to unpause the game and it freezes
I am also noob in terms of formullating questions, so if you need more information, i’ll give you.
Ty guys and sorry for bad indentation in code copying