How to fix changing scenes in exported projects

Godot Version

4.1

Question

Hello, I have a problem when testing my Godot 4.1 video game. The problem is that it does not change the scene using the “get_tree().change_scene_to_file()” method in the exported application but in the godot editor it works perfectly for me.

https://drive.google.com/drive/folders/1c-4oSOHMViWoINDf6e80ReH-NHPJ9h7l?usp=drive_link

It would probably increase your odds of getting an answer if people weren’t required to download more than 1 GB of data. Anyway, I did it, exported your game (to Linux, though) and it worked without issues (at least when clicking the buttons in the menu). I also didn’t spot anything obviously wrong in your export settings. Do the issues occur with all of your three export presets or just a specific one? Have you tried exporting with “DEBUG enabled” and checked the logs for any errors?

1 Like

Good afternoon, thank you for downloading and trying it. It exports the project with Debug and without Debug, and in both cases the stage scene does not change. Of the export options, I only tried the “Export project…” option. And in export mode I am using “Export selected scenes (and dependencies)”.

When using “Export selected scenes (and dependencies)” do you select all scenes and resources in the list below? Going back to “Export all resources in the this project”

1 Like

Yes, I select all scenes and resources. I try the two methods

When the application starts i have this errors:

ERROR: No loader found for resource: res://Calavera Pixel Art - GÚnesis Toxical (1).png.
at: (core/io/resource_loader.cpp:281)
ERROR: Can’t load dependency: res://Calavera Pixel Art - GÚnesis Toxical (1).png.
at: (core/io/resource_format_binary.cpp:458)
ERROR: Condition “!texture_allocs_cache.has(p_id)” is true.
at: texture_free_data (drivers/gles3/storage/utilities.h:111)
ERROR: Failed loading resource: res://.godot/exported/133200997/export-b7248b01c0315682a4ae3973fbad6564-Tablero.scn. Make sure resources have been imported by opening the project in the editor at least once.

And when i press the button of start game i have this errors:

ERROR: Condition “nc == 0” is true. Returning: nullptr
at: instantiate (scene/resources/packed_scene.cpp:92)
ERROR: Parameter “new_scene” is null.
at: change_scene_to_packed (scene/main/scene_tree.cpp:1418)

The final errors (after pressing the button) just tell you that the new_scene you’re trying to switch to is null, i.e. non-existent. That likely is because something went wrong when loading the exported resource Tablero.scn. You should check that you really exported all the files needed by that scene. If you do, make sure that it’s not about the names of the files (remove spaces and special characters). Regarding the first errors you posted: At least in the project you’ve uploaded, there is no file called “Calavera Pixel Art - GÚnesis Toxical (1).png”, only “Calavera Pixel Art - Génesis Toxical (1).png”! That might also be the culprit – try renaming it to something simple and export the game again.

Good evening, I have tried what you told me. Regarding the first comment I did two things, first I put an if to check if the scene was not null and second in the section where it lets you choose the resources you want to export I went one by one removing the ones that do not interest me and making sure that the scene “Tablero.tscn” is selected. As for the second comment, I changed the name of everything that had a space in its name or had special characters such as accents, I don’t know if _ count as special characters so I haven’t removed them. After doing all this I exported it again and it keeps telling me the same thing, I honestly don’t know what could be happening or why it works for you and not for me.