I am working on a game this summer and have been having an issue where my game export only works when I use export with debug. I am working on a 2D game on Godot 3.4 Mono version. When I run my game executable with debug I get no errors and am able to switch from my title screen to the main scene with no issues or errors in the console. When I try the same thing on my release version the button to switch to the main scene works because it starts our fade to black transition but then it brings me back to the title screen even though this isn't the behavior I see on debug mode. Has anyone encountered an error like this before? If so what can be done about it?
Godot Export Working on Debug but not Release For Scene Switching With Button
Yes, it probably means you made a typo with the case on the path names. Everything with string names or path names is case sensitive. So myScene.tscn
and MyScene.tscn
are not the same. However, debug and release have different behavior, which I think is a bug, but whatever. So please check that the file names are exact in relation to case.
Unfortunately seems not to be the problem I have this code here showing the scene changing code and the file names seem to be matching.
Probably an issue with yield. I recommend that people never use yield, because it causes all sorts of problems that are difficult to debug. You should just have a timer and a named function that happens on the timeout.
- Best Answerset by Facade1301
The last time I ran into an issue like that, it turned out to be an assertion that was being skipped in the non-debug export. If you can post a subset of your project (elsewhere, since we can't post compressed files yet) that has the problem, someone might be able to spot the issue.
- Edited
Also might be a good idea to check the path prior to attempting to change scenes, not after.
print(ResourceLoader.exists("res://your_level.tscn"))
This solved it for me I just removed the assert there and just called the scene change and I can make sure that the path exists by checking the ResourceLoader.exsists as cybereality reccomended. Thanks for both of your help.
Oh yes, sorry I didn't catch that. assert
is only run in debug mode. It's equivalent to a comment when you run in release, so that code will never run. That makes sense.