How to fix the error and the reason why the error has Formed in the first place
Any help would be appreciated
This is happening because you are trying to change scenes before the frame’s physics calculations are finished - there are a few other topics about this elsewhere. The solution is to make these calls wait until after those calculations are completed, and this is done with call_deferred()
Replace line 29 with get_tree().call_deferred("reload_current_scene")
Replace line 33 with
get_tree().call_deferred("change_scene_to_file", next_level_file)
That should clear everything up =)
Thank you for your reply is this an error that only happens in Godot 4.2.2 And not in Godot 3.5? And does it have anything to do with the print statements too? Also is there a error with the videos for 3D course for Godot?
No. It was always a best practice for Godot 4.x, but the error seems to fire more reliably now.
Haven’t used Godot 3.x - no idea. If there’s something similar, I would still use it there.
Nothing to do with the print statements
If you’re asking if the same error occurs anywhere in Bram’s course, I don’t think so, but I’m not absolutely certain because I handle scene management in a completely different way in my own projects. If it does pop up, it won’t matter though, since you know how to fix it now =)
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.