Change_scene_to_file vs. change_scene_to_packed?

I went through the 2D godot course first where level switching was handled with a PackedScene variable passed to change_scene_to_packed(), but here we use a file path and chance_scene_to_file(). What is the difference between the two? When or why would you use one over the other?

  • change_scene_to_packed() takes a PackedScene as input and directly switches to the scene you give it.
  • change_scene_to_file() takes a string value instead. This string value is the filepath to the scene, so it will look up the file at that path and load it.

Either one generally works just fine and it only comes down to whatever data type is more practical for your given situation (for example, if you’re looking up possible scenes from a list of filepaths, you might as well use change_scene_from_file() for obvious reasons). My personal experience has been that change_scene_to_file() is less prone to complications, but I’m maybe a little biased because of the problems I had to fix when I was extending my projects from Kaan’s 2D course.

1 Like

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

Privacy & Terms