When using get_tree().change_scene_to_file(next_level_file) to change scenes the editor suggests using .call_deferred according to the documentation it does " Calls the method represented by this Callable in deferred mode, i.e. at the end of the current frame. Arguments can be passed and should match the method’s signature"
You can call it by get_tree().call_deferred(“change_scene_to_file”, next_level_file) which clears the error.
2 Likes